Skip to main content

HasElements

Trait HasElements 

Source
pub trait HasElements<K: Kind>: 'static {
    type Element<'a>;

    const SINGLETON: Option<&'static str> = None;

    // Required method
    fn element(&self, name: &str) -> GeopResult<Self::Element<'_>>;

    // Provided methods
    fn undefined() -> Option<&'static Self> { ... }
    fn names_target(name: &str) -> bool { ... }
}
Expand description

A target that holds elements of the kind K, each by a stable name. Elements are the only way a target is read: one meant to be read whole — a sketch, to sweep — is a kind of its own, impl Kind for Sketch and impl HasElements<Sketch> for Sketch, its one element the empty name (ElementReference::whole).

Provided Associated Constants§

Source

const SINGLETON: Option<&'static str> = None

The name of the one target of this type a part has, if it has only one — the topology, say: a reference into it is saved as the element’s name alone.

Required Associated Types§

Source

type Element<'a>

What an element resolves to: a borrow of it, or what it gives.

Required Methods§

Source

fn element(&self, name: &str) -> GeopResult<Self::Element<'_>>

The element name, or why there is none.

Provided Methods§

Source

fn undefined() -> Option<&'static Self>

What the target reads as where no step made it, if it reads as anything then — the datums every part starts with. None by default: reading it fails.

Source

fn names_target(name: &str) -> bool

Whether the target named name could be one of this type: what tells a pick of an element of it from one of a target of another type with elements of the same kind (ElementReference::from_picked). The singleton’s name, for a singleton; any name, by default.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§