pub struct UseReducedMotion {
pub reduced: Signal<bool>,
pub query: &'static str,
/* private fields */
}Expand description
Reactive state for the user’s motion preference.
The handle carries the current answer and the teardown that removes
the change listener from the browser’s MediaQueryList.
A true answer means the user asked the operating system to
minimise animation, and the UI should replace motion with a
cross-fade. The global stylesheet already honours the preference for
its own transitions; this handle exists for the component-level
decisions a stylesheet cannot make.
Fields§
§reduced: Signal<bool>Whether the user asked for reduced motion.
query: &'static strThe media query text this handle watches.
Implementations§
Source§impl UseReducedMotion
Inherent implementation of UseReducedMotion.
impl UseReducedMotion
Inherent implementation of UseReducedMotion.
Sourcepub fn is_reduced(&self) -> bool
pub fn is_reduced(&self) -> bool
Returns the current answer as a snapshot.
§Returns
bool-truewhen the user asked for reduced motion.
Source§impl UseReducedMotion
impl UseReducedMotion
pub fn get_reduced(&self) -> Signal<bool>
pub fn get_mut_reduced(&mut self) -> &mut Signal<bool>
pub fn set_reduced(&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 UseReducedMotion
impl Clone for UseReducedMotion
Source§impl Debug for UseReducedMotion
impl Debug for UseReducedMotion
Auto Trait Implementations§
impl !RefUnwindSafe for UseReducedMotion
impl !Send for UseReducedMotion
impl !Sync for UseReducedMotion
impl !UnwindSafe for UseReducedMotion
impl Freeze for UseReducedMotion
impl Unpin for UseReducedMotion
impl UnsafeUnpin for UseReducedMotion
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