Skip to main content

OperationInfo

Struct OperationInfo 

Source
pub struct OperationInfo {
    pub label: &'static str,
    pub doc: &'static str,
    pub group: OperationGroup,
    pub tier: OperationTier,
    pub experimental: bool,
    pub picks_built: bool,
    pub picks_whole: bool,
    pub reads: &'static [&'static str],
    pub icon: Option<&'static str>,
    pub shortcut: Option<&'static str>,
    pub kept_on_escape: bool,
}
Expand description

What an operation is to an editor: its short name and what it does — what an editor offers it by — and where and how prominently the editor offers it.

Fields§

§label: &'static str§doc: &'static str§group: OperationGroup§tier: OperationTier§experimental: bool

Not yet robust enough to offer by default: an editor’s reduced mode leaves it out.

§picks_built: bool

Whether its reference fields pick in the part as the step builds it, rather than as it was before: a placed part’s mates pick elements of the part it places.

§picks_whole: bool

Whether its reference fields pick in the part as the whole program builds it, the steps after its own too — and its step is edited with them built. For a step that says something of the finished part and reads none of it, wherever in the program it stands: the properties’ colours of faces, usually the first step, of faces later steps make.

§reads: &'static [&'static str]

The extensions of the files its steps read that are no programs — data a program keeps beside it, a STEP file: what a front end keeps in a workspace with the programs, and sends the editor.

§icon: Option<&'static str>

What it is shown as: SVG on a 20 × 20 grid, drawn in the current colour — strokes currentColor, unfilled unless it says otherwise — that a front end puts in an <svg> of its own. None to show its label.

§shortcut: Option<&'static str>

The key that starts a new step of it while none is edited — a letter, Shift+ one for the less used — as every front end offers and shows it: E, Shift+F. Unique among the operations offered; F and Home are the view’s (framing it), ? lists the keys.

§kept_on_escape: bool

Whether Escape, with nothing in progress in a step of it, puts the step into the program as OK does, rather than cancelling it: a sketch is drawing its user expects kept, as every CAD program keeps a sketch left by Escape (see crate::editor::Editor::handle).

Implementations§

Source§

impl OperationInfo

Source

pub const fn new( label: &'static str, doc: &'static str, group: OperationGroup, tier: OperationTier, ) -> Self

An operation offered by default, whose reference fields pick in the part as it was before the step.

Source

pub const fn experimental(self) -> Self

The same, but left out of an editor’s reduced mode.

Source

pub const fn picks_built(self) -> Self

The same, but picking in the part as the step builds it.

Source

pub const fn picks_whole(self) -> Self

The same, but picking in the part as the whole program builds it.

Source

pub const fn reads(self, reads: &'static [&'static str]) -> Self

The same, its steps reading files of the extensions reads.

Source

pub const fn shortcut(self, shortcut: &'static str) -> Self

The same, started by the key shortcut (see OperationInfo::shortcut).

Source

pub const fn kept_on_escape(self) -> Self

The same, kept when Escape leaves a step of it (see OperationInfo::kept_on_escape).

Source

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

The same, shown as icon (see OperationInfo::icon).

Trait Implementations§

Source§

impl Clone for OperationInfo

Source§

fn clone(&self) -> OperationInfo

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for OperationInfo

Source§

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

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

impl PartialEq for OperationInfo

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl Serialize for OperationInfo

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 OperationInfo

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.