pub struct OwnedNode {
pub type_name: String,
pub id: Option<String>,
pub classes: Vec<String>,
pub state: State,
pub position: Position,
}Expand description
A convenience node that owns its data (String / Vec<String>).
Handy for tests, one-off queries, and places where you want to build a node
from runtime-owned strings. It is not allocation-free: each
OwnedNode::new allocates a String, and StyledNode::classes
allocates one Vec per call. For the per-frame draw loop, use NodeRef.
Fields§
§type_name: String§id: Option<String>§classes: Vec<String>§state: State§position: PositionImplementations§
Source§impl OwnedNode
impl OwnedNode
pub fn new(type_name: impl Into<String>) -> Self
pub fn with_id(self, id: impl Into<String>) -> Self
pub fn with_classes( self, classes: impl IntoIterator<Item = impl Into<String>>, ) -> Self
pub fn with_state(self, state: State) -> Self
Sourcepub fn with_position(self, position: Position) -> Self
pub fn with_position(self, position: Position) -> Self
Set the sibling position. Mirrors NodeRef::position.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for OwnedNode
impl RefUnwindSafe for OwnedNode
impl Send for OwnedNode
impl Sync for OwnedNode
impl Unpin for OwnedNode
impl UnsafeUnpin for OwnedNode
impl UnwindSafe for OwnedNode
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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