pub struct CommandSet {
available: Vec<Command>,
writability: Writability,
viewing: Viewing,
history: History,
}Expand description
The frame’s available commands, in the canonical presentation order the selection overlay renders them in.
Fields§
§available: Vec<Command>§writability: WritabilityApplied by Self::push, so the withholding happens once instead of
at each of the thirty-odd sites that offer a command.
viewing: Viewing§history: HistoryWhich kind of entry undo and redo stand over, since that is what says whether they write.
Implementations§
Source§impl CommandSet
impl CommandSet
pub fn available(ctx: &CommandContext<'_, '_>) -> Self
Sourcefn nudges(&mut self, headings: &[Heading])
fn nudges(&mut self, headings: &[Heading])
The arrow keys’ moves, which draw no control of their own.
fn selection_commands(&mut self, sel: &Deletable, data: &Drawing<'_>)
Sourcefn editor_commands(&mut self, sel: &Deletable, data: &Drawing<'_>)
fn editor_commands(&mut self, sel: &Deletable, data: &Drawing<'_>)
The in-place label editors the selection can open — the same tools the double-click path arms. Palette-only: none has an overlay button.
Sourcefn offer_editor(
&mut self,
data: &Drawing<'_>,
id: CommandId,
label: &'static str,
target: EditTarget,
)
fn offer_editor( &mut self, data: &Drawing<'_>, id: CommandId, label: &'static str, target: EditTarget, )
Offered where the editor would open now. The command names the field, not the editor, so dispatch builds the editor again against the drawing as it then stands.
fn block_commands(&mut self, rid: BlockId, data: &Drawing<'_>)
fn push(&mut self, id: CommandId, label: &'static str, act: impl Into<Act>)
Sourcefn push_by_name_only(
&mut self,
id: CommandId,
label: &'static str,
act: impl Into<Act>,
)
fn push_by_name_only( &mut self, id: CommandId, label: &'static str, act: impl Into<Act>, )
Available to name — a chord, the palette’s text field, a script’s
command step — but not rendered as a control. The accent and I/O
values are the case this exists for: nine colours and three
directions are a picker’s job on screen, and nine more buttons would
bury the selection bar, but each still has to be sayable or a script
could not set one.
Sourcefn offer(
&mut self,
id: CommandId,
label: &'static str,
act: Act,
rendered: Rendered,
)
fn offer( &mut self, id: CommandId, label: &'static str, act: Act, rendered: Rendered, )
The one gate every command passes through. A read-only session marks
the writing half of the registry withheld here — not at the call
sites — and every door that invokes (a chord, the palette, a
script’s command step, a click) skips a withheld command, so
keeping it around for the overlay to draw disabled cannot make it
reachable.
Sourcefn allows(&self, id: CommandId) -> bool
fn allows(&self, id: CommandId) -> bool
Whether id survives the frame’s two read-only questions. They are
two questions — a container this session may not write, and a past
rev on the canvas — with one answer: nothing writes the document
through the lens. The way out of it is Return or a Save-as, and a
Save-as writes a file, never this log. Undo and redo go with the
rest when they author — they would act on the head nobody is
looking at — and stay when they do not.
Sourcefn writes(&self, id: CommandId) -> bool
fn writes(&self, id: CommandId) -> bool
Whether id would write this frame. Undo and redo answer with the
kind of entry they stand over: taking back a camera move
restores a camera and touches no log, so it survives both the lens and
a container this session may not write. Every other command answers
from its own identity.
Sourcepub fn iter(&self) -> impl Iterator<Item = &Command>
pub fn iter(&self) -> impl Iterator<Item = &Command>
The invocable commands to render. Everything else is reachable by
name through Self::take.
Sourcepub fn iter_drawn(&self) -> impl Iterator<Item = &Command>
pub fn iter_drawn(&self) -> impl Iterator<Item = &Command>
Every command that draws a control, the withheld ones included — the selection overlay’s view, which renders those disabled rather than leaving a hole where a control was.
Sourcepub fn iter_all(&self) -> impl Iterator<Item = &Command>
pub fn iter_all(&self) -> impl Iterator<Item = &Command>
Every command this frame offers, drawn or not — what a front end that carries the whole registry across a seam reads, so a chord bound to a by-name-only command still resolves there.
pub fn contains(&self, id: CommandId) -> bool
pub fn get(&self, id: CommandId) -> Option<&Command>
Trait Implementations§
Source§impl<'de> Deserialize<'de> for CommandSet
impl<'de> Deserialize<'de> for CommandSet
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for CommandSet
impl PartialEq for CommandSet
Source§impl Serialize for CommandSet
impl Serialize for CommandSet
impl StructuralPartialEq for CommandSet
Auto Trait Implementations§
impl Freeze for CommandSet
impl RefUnwindSafe for CommandSet
impl Send for CommandSet
impl Sync for CommandSet
impl Unpin for CommandSet
impl UnsafeUnpin for CommandSet
impl UnwindSafe for CommandSet
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<D> OwoColorize for D
impl<D> OwoColorize for D
§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
§fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
§fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
§fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
§fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
§fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
§fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
§fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
§fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
§fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
§fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
§fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
§fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
§fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
§fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
§fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
§fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
§fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
§fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
§fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
§fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
§fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
§fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
§fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
§fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::fg] or
a color-specific method, such as [OwoColorize::green], Read more§fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::bg] or
a color-specific method, such as [OwoColorize::on_yellow], Read more