Skip to main content

Action

Enum Action 

Source
pub enum Action {
Show 39 variants Arm(ToolName), ToggleDiagnostic, ToggleFrameRate, ArmAddRouteLabel(RouteId), OpenEditor(EditTarget), StampTool { tool: ToolName, at: Pos2, }, Delete(Deletable), Copy(Vec<ShapeId>), CopyPins(Vec<PinId>), Cut(Vec<ShapeId>), CutPins(Vec<PinId>), SetPinTags { pins: Vec<PinId>, tags: TagVisibility, }, SetShapeTagHidden { shape: ShapeId, tags: TagVisibility, }, FlipShapePins(ShapeId), FlipBlockVertical(BlockId), SetBlockLocked { block: BlockId, lock: InterfaceLock, }, Paste(String), ExpandBlock(BlockId), Zoom(ZoomStep), GoToPath(BlockPath), SetRole { target: RoleTarget, role: Option<u8>, }, SetPinsKind { pins: Vec<PinId>, kind: PinDir, }, GoUp, AcknowledgeFailure(usize), FrameRect(Rect), NavSelect { block: BlockId, extend: bool, }, Undo, Redo, Nudge { dx: i32, dy: i32, }, ResetView, Export { format: ExportFormat, selection: Option<Vec<ShapeId>>, }, SetIcon { block: BlockId, asset: Asset, }, PlaceImage { asset: Asset, }, Reroute(RouteId), RerouteBlock(BlockId), ViewRev(Rev), ViewHead, SetPalette(Palette), TagRev { at: Rev, name: String, how: Tagging, },
}
Expand description

What the core executes, as a front end or a tool says it. Holds no Tool: a tool the front end asks for is named — by its ToolName, the route it labels, the field it edits — and built against the drawing as it stands when the action is applied.

Variants§

§

Arm(ToolName)

Arm the fresh tool Tool::from_name gives for this name.

§

ToggleDiagnostic

Toggle the author’s diagnostic overlay.

§

ToggleFrameRate

Toggle the frame-rate readout the front end shows.

§

ArmAddRouteLabel(RouteId)

Arm the label tool on this route.

§

OpenEditor(EditTarget)

Open the in-place editor on this field. A field that is no longer there, or no longer editable, opens nothing.

§

StampTool

Stamp tool’s default thing at the world point at — what a cell dragged off the tool cluster and dropped on the canvas comes to (crate::stamp). Arming and stamping are the cell’s two gestures, and this is the one that does not arm.

Fields

§at: Pos2
§

Delete(Deletable)

§

Copy(Vec<ShapeId>)

Copy the given shapes (and the routes among them) to the clipboard.

§

CopyPins(Vec<PinId>)

Copy a group of child-block pins to the clipboard (as a pin payload).

§

Cut(Vec<ShapeId>)

Copy the given shapes to the clipboard, then delete them (one undo step).

§

CutPins(Vec<PinId>)

Copy a group of child-block pins to the clipboard, then delete them.

§

SetPinTags

Set every listed pin’s tag to tags.

Fields

§pins: Vec<PinId>
§

SetShapeTagHidden

Set a selected shape’s own label — a child block’s tag, or a port’s pin tag — to tags.

Fields

§shape: ShapeId
§

FlipShapePins(ShapeId)

Flip a selected shape’s pins to the opposite edge — a port’s single pin, or all of a child block’s pins — and re-route.

§

FlipBlockVertical(BlockId)

Vertically mirror a selected child block’s pins — a pin near the top moves to the bottom and vice versa, each keeping its East/West side — and re-route. Scoped to blocks (ports carry a single pin, nothing to mirror).

§

SetBlockLocked

Lock or unlock a child block: a locked block keeps its pin/port interface frozen (no rename/retype/tag/add/delete of pins or ports) while still allowing whole-block moves, deletes, resizes, and aesthetic edits.

Fields

§block: BlockId
§

Paste(String)

Paste a clipboard JSON payload into the current level.

§

ExpandBlock(BlockId)

§

Zoom(ZoomStep)

Step the zoom in or out about the pointer — the keyboard’s zoom, where the wheel zooms about the cursor continuously.

§

GoToPath(BlockPath)

Navigate to a level by its whole path — the palette’s go <path>, which parses a content-path string (see crate::content_path).

§

SetRole

Accent target — what the picker reports, rather than what it writes. A popup that wrote the document itself was the only mutation in the app reachable by no other route, and so the only one no test could drive; as an action it dispatches like every other write and a script can ask for it by name.

Fields

§target: RoleTarget
§role: Option<u8>

The accent index the picker reports; None is “no accent”, the target’s own un-accented stroke.

§

SetPinsKind

Set the I/O direction of every listed pin — the pin-type picker’s report, on the same terms as Action::SetRole.

Fields

§pins: Vec<PinId>
§kind: PinDir
§

GoUp

§

AcknowledgeFailure(usize)

The user is done with one of the session’s failure notices, named by its position among them.

§

FrameRect(Rect)

Frame this world rect — the palette’s camera <x> <y> <w> <h>, the same framing a scripted camera step applies.

§

NavSelect

Select a block chosen in the navigation dialog: replace the selection (or, with extend, toggle it into the current selection like a canvas shift-click), then pan/zoom the canvas to frame that block.

Fields

§block: BlockId
§extend: bool
§

Undo

Restore the previous document/navigation snapshot.

§

Redo

Re-apply a snapshot undone by Action::Undo.

§

Nudge

Arrow-key move of the current selection: shapes shift by (dx, dy) grid cells; a pin selection shifts by dy slots (dx ignored).

Fields

§dx: i32
§dy: i32
§

ResetView

Reset zoom/pan so the whole document fits in the viewport.

§

Export

Export what is on the canvas in format — or, when selection names shapes, those shapes as a standalone diagram. What comes of it is bytes and a name, handed back through the session’s one hand-off slot; which file they are written to is the host’s own business.

Fields

§selection: Option<Vec<ShapeId>>
§

SetIcon

Wear this artwork as the block’s foreground icon.

Fields

§block: BlockId
§asset: Asset
§

PlaceImage

Draw this artwork as an image of its own. Where it goes is the session’s to say — the picker the shell ran knows nothing about the canvas — so it lands centred on the point a paste lands on, at the artwork’s own aspect.

Fields

§asset: Asset
§

Reroute(RouteId)

Rip up a route and autoroute it fresh with no waypoints.

§

RerouteBlock(BlockId)

Rip up and autoroute every route with an endpoint on this block.

§

ViewRev(Rev)

Put a past rev on the canvas, read-only — the time machine.

§

ViewHead

Leave the past for the writable head.

§

SetPalette(Palette)

Paint the drawing in this palette from now on — the front end’s theme, told. Not an edit: it spends no rev, the undo stack does not move, and a read-only session takes it.

§

TagRev

Put a name on a rev, or take one off. Not an edit: it spends no rev and the undo stack does not move.

Fields

§at: Rev
§name: String

Implementations§

Source§

impl Action

Source

pub fn label(&self) -> &'static str

What the commit this action produces is called — the stable command name where a named command triggered it, so the log, undo, and review all read the same word for the same gesture. Actions that write nothing still carry one: the gesture opens before the dispatcher knows which arm will take it.

Trait Implementations§

Source§

impl<'de> Deserialize<'de> for Action

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl From<Action> for Act

Source§

fn from(action: Action) -> Self

Converts to this type from the input type.
Source§

impl From<Action> for Transition

Source§

fn from(action: Action) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for Action

Source§

fn eq(&self, other: &Action) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for Action

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
Source§

impl StructuralPartialEq for Action

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

§

impl<D> OwoColorize for D

§

fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>
where C: Color,

Set the foreground color generically Read more
§

fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>
where C: Color,

Set the background color generically. Read more
§

fn black(&self) -> FgColorDisplay<'_, Black, Self>

Change the foreground color to black
§

fn on_black(&self) -> BgColorDisplay<'_, Black, Self>

Change the background color to black
§

fn red(&self) -> FgColorDisplay<'_, Red, Self>

Change the foreground color to red
§

fn on_red(&self) -> BgColorDisplay<'_, Red, Self>

Change the background color to red
§

fn green(&self) -> FgColorDisplay<'_, Green, Self>

Change the foreground color to green
§

fn on_green(&self) -> BgColorDisplay<'_, Green, Self>

Change the background color to green
§

fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>

Change the foreground color to yellow
§

fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>

Change the background color to yellow
§

fn blue(&self) -> FgColorDisplay<'_, Blue, Self>

Change the foreground color to blue
§

fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>

Change the background color to blue
§

fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>

Change the foreground color to magenta
§

fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>

Change the background color to magenta
§

fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>

Change the foreground color to purple
§

fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>

Change the background color to purple
§

fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>

Change the foreground color to cyan
§

fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>

Change the background color to cyan
§

fn white(&self) -> FgColorDisplay<'_, White, Self>

Change the foreground color to white
§

fn on_white(&self) -> BgColorDisplay<'_, White, Self>

Change the background color to white
§

fn default_color(&self) -> FgColorDisplay<'_, Default, Self>

Change the foreground color to the terminal default
§

fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>

Change the background color to the terminal default
§

fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>

Change the foreground color to bright black
§

fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>

Change the background color to bright black
§

fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>

Change the foreground color to bright red
§

fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>

Change the background color to bright red
§

fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>

Change the foreground color to bright green
§

fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>

Change the background color to bright green
§

fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>

Change the foreground color to bright yellow
§

fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>

Change the background color to bright yellow
§

fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>

Change the foreground color to bright blue
§

fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>

Change the background color to bright blue
§

fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>

Change the foreground color to bright magenta
§

fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>

Change the background color to bright magenta
§

fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>

Change the foreground color to bright purple
§

fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>

Change the background color to bright purple
§

fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>

Change the foreground color to bright cyan
§

fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>

Change the background color to bright cyan
§

fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>

Change the foreground color to bright white
§

fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>

Change the background color to bright white
§

fn bold(&self) -> BoldDisplay<'_, Self>

Make the text bold
§

fn dimmed(&self) -> DimDisplay<'_, Self>

Make the text dim
§

fn italic(&self) -> ItalicDisplay<'_, Self>

Make the text italicized
§

fn underline(&self) -> UnderlineDisplay<'_, Self>

Make the text underlined
Make the text blink
Make the text blink (but fast!)
§

fn reversed(&self) -> ReversedDisplay<'_, Self>

Swap the foreground and background colors
§

fn hidden(&self) -> HiddenDisplay<'_, Self>

Hide the text
§

fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>

Cross out the text
§

fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>
where Color: DynColor,

Set the foreground color at runtime. Only use if you do not know which color will be used at compile-time. If the color is constant, use either [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,

Set the background color at runtime. Only use if you do not know what color to use at compile-time. If the color is constant, use either [OwoColorize::bg] or a color-specific method, such as [OwoColorize::on_yellow], Read more
§

fn fg_rgb<const R: u8, const G: u8, const B: u8>( &self, ) -> FgColorDisplay<'_, CustomColor<R, G, B>, Self>

Set the foreground color to a specific RGB value.
§

fn bg_rgb<const R: u8, const G: u8, const B: u8>( &self, ) -> BgColorDisplay<'_, CustomColor<R, G, B>, Self>

Set the background color to a specific RGB value.
§

fn truecolor(&self, r: u8, g: u8, b: u8) -> FgDynColorDisplay<'_, Rgb, Self>

Sets the foreground color to an RGB value.
§

fn on_truecolor(&self, r: u8, g: u8, b: u8) -> BgDynColorDisplay<'_, Rgb, Self>

Sets the background color to an RGB value.
§

fn style(&self, style: Style) -> Styled<&Self>

Apply a runtime-determined style
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> 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
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,