Skip to main content

FacetDeck

Struct FacetDeck 

Source
pub struct FacetDeck { /* private fields */ }
Expand description

A tabbed set of Facets — the reusable multi-component shell. Draws a tab bar + the active facet, and composes every facet’s state_json under its title, so the whole-app introspection contract is free. korp/nornir can build their window from a FacetDeck instead of hand-rolling tabs + the state dump.

Implementations§

Source§

impl FacetDeck

Source

pub fn new(facets: Vec<Box<dyn Facet>>) -> Self

Source

pub fn active(&self) -> usize

Source

pub fn facet_mut<T: Any>(&mut self, title: &str) -> Option<&mut T>

Typed mutable access to the facet with title, downcast to TNone if no such facet, or it doesn’t opt into Facet::as_any_mut, or the type mismatches. Lets a host drive a concrete component’s own API (e.g. a robot-UI control forwarding a node selection to a SystemChart).

Source

pub fn with_fx(self, fx: DeckFx) -> Self

Enable deck effects up front (builder form of fx_mut).

Source

pub fn fx(&self) -> &DeckFx

The current deck-effects config (read-only).

Source

pub fn fx_mut(&mut self) -> &mut DeckFx

Mutate the deck-effects config (toggle glow, pin a palette, …).

Source

pub fn set_palette(&mut self, i: usize)

Override the deck theme with palette index i (wraps); enables the override. Convenience over fx_mut().set_palette(i).

Source

pub fn cycle_palette(&mut self) -> usize

Advance to the next palette in Theme::ALL (wrapping); returns the new index. Convenience over fx_mut().cycle_palette().

Source

pub fn send_raven(&mut self, target: Rect)

Summon the raven to perch on target — any rect a facet/host hands us (a table row, a node, a header). Replaces any raven already in flight. The body is tinted from the deck’s current palette (or the host theme). Logs an activity trail entry. Drive/paint happens automatically inside ui.

Source

pub fn has_raven(&self) -> bool

True while a raven is present (flying or perched).

Source

pub fn raven_perched(&self) -> bool

True once the summoned raven has landed (false if none).

Source

pub fn clear_raven(&mut self)

Dismiss any raven.

Source

pub fn palette_picker(&mut self, ui: &mut Ui) -> Option<usize>

Draw a one-line palette picker — a switcher over Theme::ALL the host can place anywhere (toolbar, menu). Selecting a palette pins the fx override; ui() then applies it each frame. Returns the chosen index if it changed this frame.

Source

pub fn active_caps(&self) -> FacetCaps

The capabilities of the currently-active facet (or NONE if empty).

Source

pub fn ui(&mut self, ui: &mut Ui)

Draw the tab bar + capability toolbar + the active facet, and route capability-gated shortcuts (Ctrl-+/-/0 for scale; Ctrl-C/X/V for clipboard).

Source

pub fn state_json(&self) -> Value

The whole-app observable state: the active facet + each facet’s state_json, plus an additive sibling caps map (title → caps JSON) so the existing flat facets[title] shape is unchanged for consumers.

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, S> SimdFrom<T, S> for T
where S: Simd,

Source§

fn simd_from(value: T, _simd: S) -> T

Source§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

Source§

fn simd_into(self, simd: S) -> T

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.