Skip to main content

Selectable

Trait Selectable 

Source
pub trait Selectable:
    Clone
    + PartialEq
    + 'static {
    // Required methods
    fn picked_from() -> Vec<&'static str>;
    fn from_picked(picked: &PickedElement) -> Option<Self>;
    fn picked(&self) -> PickedElement;
    fn select(reader: &Reader<'_>, hit: &PickedElement) -> Option<Self>;
    fn drawn(&self, reader: &Reader<'_>) -> Vec<PickedElement>;

    // Provided method
    fn visuals(&self, reader: &Reader<'_>) -> Vec<Visual> { ... }
}
Expand description

What a reference field holds, one value per pick.

Required Methods§

Source

fn picked_from() -> Vec<&'static str>

The kinds of what an editor draws that a click picks one from.

Source

fn from_picked(picked: &PickedElement) -> Option<Self>

The value picked names as Selectable::picked does: what a field sent back held already.

Source

fn picked(&self) -> PickedElement

The value as a pick names it: what the front end shows held.

Source

fn select(reader: &Reader<'_>, hit: &PickedElement) -> Option<Self>

The value a click on hit selects, read through reader: none, for a hit that selects none.

Source

fn drawn(&self, reader: &Reader<'_>) -> Vec<PickedElement>

What an editor draws of it, to light while it is held.

Provided Methods§

Source

fn visuals(&self, reader: &Reader<'_>) -> Vec<Visual>

What an editor draws of it besides lighting what it is picked from (Selectable::drawn), while it is held or a click would pick it: nothing, for an element drawn as itself; a frame, as a triad along its axes. In the world, as the part is drawn; styled by the editor as held or as hovered.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementations on Foreign Types§

Source§

impl<T: HasElements<K>, K: SelectableElement<T>> Selectable for ElementReference<T, K>

An element of an instance is selected and drawn as the instance’s own part selects and draws it, behind the instance’s path: what the part is placed in does not discriminate where an element is from.

Source§

fn picked_from() -> Vec<&'static str>

Source§

fn from_picked(picked: &PickedElement) -> Option<Self>

Source§

fn picked(&self) -> PickedElement

Source§

fn select(reader: &Reader<'_>, hit: &PickedElement) -> Option<Self>

Source§

fn drawn(&self, reader: &Reader<'_>) -> Vec<PickedElement>

Implementors§