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<Guard>, pub can_leave: Option<Guard>, pub label: Option<Label>, pub arrangement_for: Option<ArrangementFor>,
}
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<Guard>§can_leave: Option<Guard>§label: Option<Label>

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

§arrangement_for: Option<ArrangementFor>

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

Implementations§

Source§

impl FrameSpec

Source

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

A place.

Source

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

A mode of a group.

Source

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

Source

pub fn transient(self) -> Self

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

Source

pub fn visible(self) -> Self

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) -> Self

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) -> Self

A context key set while the frame is on.

Source

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

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) -> Self

A panel a mode shows.

Source

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

A panel a mode hides.

Source

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

Whether the frame may be entered.

Source

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

Whether the frame may be left.

Source

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

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(&Json) -> Option<String> + Send + Sync + 'static, ) -> Self

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: &Json) -> Option<String>

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

Source

pub fn arrangement_of(&self, payload: &Json) -> 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

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

impl Serialize for FrameSpec

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::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
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> 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.