Skip to main content

one_of

Macro one_of 

Source
macro_rules! one_of {
    (
        $(#[$meta:meta])*
        $vis:vis enum $name:ident -> $out:ty {
            $($(#[$variant_meta:meta])* $variant:ident($reference:ty)),+ $(,)?
        }
    ) => { ... };
    (
        $(#[$meta:meta])*
        $vis:vis enum $name:ident {
            $($(#[$variant_meta:meta])* $variant:ident($reference:ty)),+ $(,)?
        }
    ) => { ... };
}
Expand description

Declares an enum of references, each variant one source of what an operation takes — a line from a straight edge, a datum axis or a sketch line — given -> Out, all resolving to the same value, Out (resolve). Saved by its variant’s name: {"edge": "extrude(e,end)"}. It is Selectable: a click selects the first variant that selects it. A value held is told from a click by its kind, so no variant may be of a kind drawn as itself that another variant selects from — a field of edges or chains would take a click on an edge for an edge held. The crate using it depends on serde.

ⓘ
one_of! {
    /// What a revolve turns about.
    pub enum AxisRef -> Axis {
        Edge(ElementReference<NamedModel, Line>),
        Datum(ElementReference<Datums, Line>),
    }
}