Skip to main content

FrameSpec

Struct FrameSpec 

Source
pub struct FrameSpec {
Show 16 fields pub id: FrameId, pub kind: Kind, pub group: Option<GroupId>, pub title: String, pub icon: Option<String>, pub transient: bool, pub visible: bool, pub tone: Option<String>, pub keys: Vec<(String, String)>, pub arrangement: Option<String>, pub show: Vec<PanelId>, pub hide: Vec<PanelId>, pub can_enter: Option<Arc<dyn Fn(&GuardCall<'_>) -> Verdict + Sync + Send>>, pub can_leave: Option<Arc<dyn Fn(&GuardCall<'_>) -> Verdict + Sync + Send>>, pub label: Option<Arc<dyn Fn(&LabelCall<'_>) -> Option<String> + Sync + Send>>, pub arrangement_for: Option<Arc<dyn Fn(&Value) -> Option<String> + Sync + Send>>,
}
Expand description

A frame as declared.

Fields§

§id: FrameId§kind: Kind§group: Option<GroupId>

A mode’s group (one mode of a group at a time); none for a place.

§title: String

For the breadcrumb and the mode chips, in English; the interface translates it through the key derived from the id, frame-<id>.title (egui_pop_core::strings::frame_title).

§icon: Option<String>

An icon’s name, for the chips and crumbs (egui_pop_core::icon).

§transient: bool

On the live stack, never restored.

§visible: bool

A mode: its group shows in the status bar, as a chip while one of its modes is on. A group is shown when any of its modes says so; a group that is pure plumbing stays out of the bar.

§tone: Option<String>

A mode: its chip’s tone, by the kit’s tone name (accent, info, success, warning, danger, muted, record); accent when none.

§keys: Vec<(String, String)>

Context keys the frame sets while it is on (the top place’s, every active mode’s).

§arrangement: Option<String>

The arrangement (a template or a saved name) the frame’s projection starts from the first time, until the user picks another there: a place’s, or a mode’s, which wins over the place’s while it is on.

§show: Vec<PanelId>

A mode: panels it shows while on.

§hide: Vec<PanelId>

A mode: panels it hides while on.

§can_enter: Option<Arc<dyn Fn(&GuardCall<'_>) -> Verdict + Sync + Send>>§can_leave: Option<Arc<dyn Fn(&GuardCall<'_>) -> Verdict + Sync + Send>>§label: Option<Arc<dyn Fn(&LabelCall<'_>) -> Option<String> + Sync + Send>>

A place: its crumb’s label from its payload.

§arrangement_for: Option<Arc<dyn Fn(&Value) -> Option<String> + Sync + Send>>

A place: the arrangement it starts from, from its payload.

Implementations§

Source§

impl FrameSpec

Source

pub fn place(id: FrameId, title: &str) -> FrameSpec

A place.

Source

pub fn mode(id: FrameId, group: GroupId, title: &str) -> FrameSpec

A mode of a group.

Source

pub fn icon(self, icon: &str) -> FrameSpec

Source

pub fn transient(self) -> FrameSpec

Never restored (an agent driving, a modal tool mode).

Source

pub fn visible(self) -> FrameSpec

A mode: shows its group in the status bar (a chip while one of its modes is on).

Source

pub fn tone(self, tone: &str) -> FrameSpec

A mode: its chip’s tone, a kit tone name (record for “an agent is driving”).

Source

pub fn key(self, key: &str, value: &str) -> FrameSpec

A context key set while the frame is on.

Source

pub fn arrangement(self, name: &str) -> FrameSpec

The arrangement the frame’s projection starts from (a place’s, or a mode’s, which wins over the place’s while it is on).

Source

pub fn show(self, panel: PanelId) -> FrameSpec

A panel a mode shows.

Source

pub fn hide(self, panel: PanelId) -> FrameSpec

A panel a mode hides.

Source

pub fn can_enter( self, f: impl Fn(&GuardCall<'_>) -> Verdict + Send + Sync + 'static, ) -> FrameSpec

Whether the frame may be entered.

Source

pub fn can_leave( self, f: impl Fn(&GuardCall<'_>) -> Verdict + Send + Sync + 'static, ) -> FrameSpec

Whether the frame may be left.

Source

pub fn label( self, f: impl Fn(&LabelCall<'_>) -> Option<String> + Send + Sync + 'static, ) -> FrameSpec

A place: its crumb’s label from its payload (a sub-workspace’s name for {"id": "…"}), wherever the interface says the crumb (the breadcrumb, context.read, an announcement, an undo toast). None keeps the default: the title, and the payload when it is a text or a number. Called while the interface draws: it must not call back into the context stack.

Source

pub fn arrangement_for( self, f: impl Fn(&Value) -> Option<String> + Send + Sync + 'static, ) -> FrameSpec

A place: the arrangement (a template or a saved name) an entry starts from, chosen from its payload; None falls back to arrangement. Read the first time a projection key is shown: the layout it was left with wins on later entries.

Source

pub fn label_of(&self, title: &str, payload: &Value) -> Option<String>

The crumb label label gives for a payload, if any.

Source

pub fn arrangement_of(&self, payload: &Value) -> Option<String>

The arrangement arrangement_for chooses for a payload, if any.

Source

pub fn clause(&self) -> String

The when clause that holds while the frame is on: place == 'id' for a place (the top one), mode.<group> == 'id' for a mode. A frame’s own key bindings use it (its keymap layer).

Trait Implementations§

Source§

impl Clone for FrameSpec

Source§

fn clone(&self) -> FrameSpec

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for FrameSpec

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Serialize for FrameSpec

Source§

fn serialize<__S>( &self, __serializer: __S, ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<T> Downcast<T> for T

§

fn downcast(&self) -> &T

§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T, S> SimdFrom<T, S> for T
where S: Simd,

§

fn simd_from(_simd: S, value: T) -> T

§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

§

fn simd_into(self, simd: S) -> T

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> Upcast<T> for T

§

fn upcast(&self) -> Option<&T>

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

§

impl<T> SerializableAny for T
where T: 'static + Any + Clone + for<'a> Send + Sync,

§

impl<T> WasmNotSend for T
where T: Send,

§

impl<T> WasmNotSendSync for T
where T: WasmNotSend + WasmNotSync,

§

impl<T> WasmNotSync for T
where T: Sync,