pub struct NodeSize { /* private fields */ }Expand description
A node whose measured size a reader follows.
The token is the name the screen gives the node, because a node id belongs to the
Renderer and never crosses back as something the Host chose. Attach it with
observe_size and read the size here. The Dioxus adapter hands one out from its
use_node_size hook.
ⓘ
let panel = use_node_size();
rsx! {
Card {
observe_size: panel.token(),
if panel.is_expanded() { Row { Left {} Right {} } } else { Left {} }
}
}A component that never calls this costs nothing: the modifier is the only thing that makes the Renderer measure, and the modifier comes from here.
Implementations§
Source§impl NodeSize
impl NodeSize
Sourcepub fn is_compact(&self) -> bool
pub fn is_compact(&self) -> bool
Phone-shaped: narrower than 600dp.
Sourcepub fn is_expanded(&self) -> bool
pub fn is_expanded(&self) -> bool
Desktop-shaped.
Sourcepub const fn measured(&self) -> WindowSize
pub const fn measured(&self) -> WindowSize
The measurement itself, zero until the Renderer has reported one.
Trait Implementations§
impl Copy for NodeSize
impl StructuralPartialEq for NodeSize
Auto Trait Implementations§
impl Freeze for NodeSize
impl RefUnwindSafe for NodeSize
impl Send for NodeSize
impl Sync for NodeSize
impl Unpin for NodeSize
impl UnsafeUnpin for NodeSize
impl UnwindSafe for NodeSize
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