dioxus_use_window/hooks/use_width/
mod.rs1mod display;
2use super::*;
3
4#[derive(Debug)]
6pub struct UseWindowWidth {
7 inner: UseWindow,
8}
9
10impl UseWindowWidth {
11 pub(crate) fn new(size: UseWindow) -> Self {
12 Self { inner: size }
13 }
14}
15
16impl UseWindowWidth {
17 #[inline]
19 pub fn get(&self) -> usize {
20 self.inner.data_ref().inner_width() as _
21 }
22 #[inline]
24 pub fn set(&self, width: usize) -> bool {
25 self.inner.data_ref().set_inner_width(width).is_some()
26 }
27 #[inline]
29 pub fn layout<T>(&self) -> T
30 where
31 T: From<usize>,
32 {
33 self.inner.layout()
34 }
35}