pub struct UseResizeObserver {
pub target: NodeRef<Element>,
pub width: Signal<f64>,
pub height: Signal<f64>,
/* private fields */
}Expand description
Reactive state for an element’s size.
The handle carries the element the hook watches — a NodeRef the
caller attaches to its own markup — and the signals that report its
content-box width and height.
The size is a Signal<f64>: a render closure that reads it
re-renders when the element is resized, and nothing else in the tree
is disturbed.
Fields§
§target: NodeRef<Element>The element the hook watches.
Attach it to the caller’s markup with the ref: attribute.
width: Signal<f64>The element’s content-box width in CSS pixels.
height: Signal<f64>The element’s content-box height in CSS pixels.
Implementations§
Source§impl UseResizeObserver
Inherent implementation of UseResizeObserver.
impl UseResizeObserver
Inherent implementation of UseResizeObserver.
Sourcepub fn current_width(&self) -> f64
pub fn current_width(&self) -> f64
Sourcepub fn current_height(&self) -> f64
pub fn current_height(&self) -> f64
Source§impl UseResizeObserver
impl UseResizeObserver
pub fn get_target(&self) -> &NodeRef<Element>
pub fn get_mut_target(&mut self) -> &mut NodeRef<Element>
pub fn set_target(&mut self, val: NodeRef<Element>) -> &mut Self
pub fn get_width(&self) -> Signal<f64>
pub fn get_mut_width(&mut self) -> &mut Signal<f64>
pub fn set_width(&mut self, val: Signal<f64>) -> &mut Self
pub fn get_height(&self) -> Signal<f64>
pub fn get_mut_height(&mut self) -> &mut Signal<f64>
pub fn set_height(&mut self, val: Signal<f64>) -> &mut Self
pub fn get_mut_teardown(&mut self) -> &mut Rc<RefCell<Option<Box<dyn Fn()>>>>
pub fn set_teardown( &mut self, val: Rc<RefCell<Option<Box<dyn Fn()>>>>, ) -> &mut Self
Trait Implementations§
Source§impl Clone for UseResizeObserver
impl Clone for UseResizeObserver
Source§impl Debug for UseResizeObserver
impl Debug for UseResizeObserver
Auto Trait Implementations§
impl !RefUnwindSafe for UseResizeObserver
impl !Send for UseResizeObserver
impl !Sync for UseResizeObserver
impl !UnwindSafe for UseResizeObserver
impl Freeze for UseResizeObserver
impl Unpin for UseResizeObserver
impl UnsafeUnpin for UseResizeObserver
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