pub struct UseMediaQuery {
pub matches: Signal<bool>,
pub query: &'static str,
/* private fields */
}Expand description
Reactive state for one CSS media query.
The handle carries the query it watches, the current match result,
and the teardown that removes the change listener from the
browser’s MediaQueryList.
The match result is a Signal<bool>: a render closure that reads it
re-renders when the query starts or stops matching, and nothing
else in the tree is disturbed.
Fields§
§matches: Signal<bool>Whether the query currently matches.
query: &'static strThe media query text this handle watches.
Implementations§
Source§impl UseMediaQuery
Inherent implementation of UseMediaQuery.
impl UseMediaQuery
Inherent implementation of UseMediaQuery.
Sourcepub fn is_matching(&self) -> bool
pub fn is_matching(&self) -> bool
Returns the current match result as a snapshot.
§Returns
bool-truewhen the query currently matches.
Source§impl UseMediaQuery
impl UseMediaQuery
pub fn get_matches(&self) -> Signal<bool>
pub fn get_mut_matches(&mut self) -> &mut Signal<bool>
pub fn set_matches(&mut self, val: Signal<bool>) -> &mut Self
pub fn get_query(&self) -> &'static str
pub fn get_mut_query(&mut self) -> &mut &'static str
pub fn set_query(&mut self, val: &'static str) -> &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 UseMediaQuery
impl Clone for UseMediaQuery
Source§impl Debug for UseMediaQuery
impl Debug for UseMediaQuery
Auto Trait Implementations§
impl !RefUnwindSafe for UseMediaQuery
impl !Send for UseMediaQuery
impl !Sync for UseMediaQuery
impl !UnwindSafe for UseMediaQuery
impl Freeze for UseMediaQuery
impl Unpin for UseMediaQuery
impl UnsafeUnpin for UseMediaQuery
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