Torin

Struct Torin 

Source
pub struct Torin<Key: NodeKey> {
    pub results: FxHashMap<Key, LayoutNode>,
    pub dirty: FxHashMap<Key, DirtyReason>,
    pub root_node_candidate: RootNodeCandidate<Key>,
}

Fields§

§results: FxHashMap<Key, LayoutNode>

Layout results of the registered Nodes

§dirty: FxHashMap<Key, DirtyReason>

Invalid registered nodes since previous layout measurement

§root_node_candidate: RootNodeCandidate<Key>

Best Root node candidate from where to start measuringg

Implementations§

Source§

impl<Key: NodeKey> Torin<Key>

Source

pub fn new() -> Self

Create a new Layout

Source

pub fn size(&self) -> usize

Source

pub fn clear_dirty(&mut self)

Clear the dirty nodes buffer

Source

pub fn reset(&mut self)

Reset the layout

Source

pub fn get_dirty_nodes(&self) -> &FxHashMap<Key, DirtyReason>

Read the HashSet of dirty nodes

Source

pub fn raw_remove(&mut self, node_id: Key)

Remove a Node’s result and data

Source

pub fn remove( &mut self, node_id: Key, tree_adapter: &mut impl TreeAdapter<Key>, invalidate_parent: bool, )

Remove a Node from the layout

§Panics

Might panic if the parent is not found.

Source

pub fn safe_invalidate(&mut self, node_id: Key)

Safely mark as dirty a Node, with no reason.

Source

pub fn invalidate(&mut self, node_id: Key)

Mark as dirty a Node, with no reason.

Source

pub fn invalidate_with_reason(&mut self, node_id: Key, reason: DirtyReason)

Mark as dirty a Node, with a reason.

Source

pub fn check_dirty_dependants( &mut self, node_id: Key, reason: DirtyReason, tree_adapter: &mut impl TreeAdapter<Key>, ignore: bool, )

Source

pub fn get_root_candidate(&self) -> RootNodeCandidate<Key>

Get the Root Node candidate

Source

pub fn find_best_root(&mut self, tree_adapter: &mut impl TreeAdapter<Key>)

Find the best root Node from where to start measuringg

Source

pub fn measure( &mut self, suggested_root_id: Key, root_area: Area, measurer: &mut Option<impl LayoutMeasurer<Key>>, tree_adapter: &mut impl TreeAdapter<Key>, )

Measure dirty Nodes

§Panics

Might panic if the final root node is not found.

Source

pub fn get(&self, node_id: &Key) -> Option<&LayoutNode>

Get a reference to LayoutNode of a Node

Source

pub fn get_mut(&mut self, node_id: &Key) -> Option<&mut LayoutNode>

Get a mutable reference to LayoutNode of a Node

Source

pub fn cache_node(&mut self, node_id: Key, layout_node: LayoutNode)

Cache a Node’s LayoutNode

Trait Implementations§

Source§

impl<Key: NodeKey> Default for Torin<Key>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<Key> Freeze for Torin<Key>
where Key: Freeze,

§

impl<Key> !RefUnwindSafe for Torin<Key>

§

impl<Key> !Send for Torin<Key>

§

impl<Key> !Sync for Torin<Key>

§

impl<Key> Unpin for Torin<Key>
where Key: Unpin,

§

impl<Key> !UnwindSafe for Torin<Key>

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. 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.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more