pub struct NodeRef<'a> { /* private fields */ }Expand description
A borrowed node: type_name, id, and classes are all &'a str /
&'a [&'a str] borrows, so construction is zero-allocation (a
compile-time guarantee when the source data is &'static).
Use this in the draw loop:
ⓘ
let node = NodeRef::new("Button").classes(&["primary"]).state(State::focus());
let computed = sheet.compute(&node, None);Builder methods mirror OwnedNode’s (with_*) for easy migration, plus
short classes/state setters.
Implementations§
Source§impl<'a> NodeRef<'a>
impl<'a> NodeRef<'a>
Sourcepub fn with_id(self, id: &'a str) -> Self
pub fn with_id(self, id: &'a str) -> Self
Alias for id, matching OwnedNode::with_id.
Sourcepub fn classes(self, classes: &'a [&'a str]) -> Self
pub fn classes(self, classes: &'a [&'a str]) -> Self
Set the class list (borrowed slice). Zero-allocation.
Sourcepub fn with_classes(self, classes: &'a [&'a str]) -> Self
pub fn with_classes(self, classes: &'a [&'a str]) -> Self
Alias for classes, matching OwnedNode::with_classes.
Sourcepub fn with_state(self, state: State) -> Self
pub fn with_state(self, state: State) -> Self
Alias for state, matching OwnedNode::with_state.
Trait Implementations§
Source§impl<'a> StyledNode for NodeRef<'a>
impl<'a> StyledNode for NodeRef<'a>
Auto Trait Implementations§
impl<'a> Freeze for NodeRef<'a>
impl<'a> RefUnwindSafe for NodeRef<'a>
impl<'a> Send for NodeRef<'a>
impl<'a> Sync for NodeRef<'a>
impl<'a> Unpin for NodeRef<'a>
impl<'a> UnsafeUnpin for NodeRef<'a>
impl<'a> UnwindSafe for NodeRef<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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