pub struct FeedbackPolicy { /* private fields */ }Expand description
Validated visual preferences, independent of authored sound and rumble.
Reduced motion disables camera shake, particle requests, hit emphasis and
presentation hit-stop. Reduced flash disables screen flashes. intensity
scales the remaining visuals in 0..=1, after authored event limits are applied, so
even an intensity-four event cannot override a preference. The default
preserves the original feedback. Hosts can read the same preferences to
suppress their own animations; this controller cannot recall particles or
reactions a host has already played.
use ferravex_play::feedback::FeedbackPolicy;
let policy = FeedbackPolicy::new(true, true, 0.5).unwrap();
assert!(policy.reduced_motion());
assert!(policy.reduced_flash());
assert_eq!(policy.intensity(), 0.5);
assert!(FeedbackPolicy::new(false, false, f32::INFINITY).is_err());Implementations§
Source§impl FeedbackPolicy
impl FeedbackPolicy
Sourcepub fn new(
reduced_motion: bool,
reduced_flash: bool,
intensity: f32,
) -> Result<FeedbackPolicy, FeedbackError>
pub fn new( reduced_motion: bool, reduced_flash: bool, intensity: f32, ) -> Result<FeedbackPolicy, FeedbackError>
Rejects non-finite intensity and values outside 0..=1.
pub fn reduced_motion(self) -> bool
pub fn reduced_flash(self) -> bool
pub fn intensity(self) -> f32
Trait Implementations§
Source§impl Clone for FeedbackPolicy
impl Clone for FeedbackPolicy
Source§fn clone(&self) -> FeedbackPolicy
fn clone(&self) -> FeedbackPolicy
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for FeedbackPolicy
impl Debug for FeedbackPolicy
Source§impl Default for FeedbackPolicy
impl Default for FeedbackPolicy
Source§fn default() -> FeedbackPolicy
fn default() -> FeedbackPolicy
Returns the “default value” for a type. Read more
Source§impl From<&FeedbackPolicy> for Motion
impl From<&FeedbackPolicy> for Motion
Source§fn from(policy: &FeedbackPolicy) -> Motion
fn from(policy: &FeedbackPolicy) -> Motion
Converts to this type from the input type.
Source§impl From<FeedbackPolicy> for Motion
impl From<FeedbackPolicy> for Motion
Source§fn from(policy: FeedbackPolicy) -> Motion
fn from(policy: FeedbackPolicy) -> Motion
Converts to this type from the input type.
Source§impl PartialEq for FeedbackPolicy
impl PartialEq for FeedbackPolicy
impl Copy for FeedbackPolicy
impl StructuralPartialEq for FeedbackPolicy
Auto Trait Implementations§
impl Freeze for FeedbackPolicy
impl RefUnwindSafe for FeedbackPolicy
impl Send for FeedbackPolicy
impl Sync for FeedbackPolicy
impl Unpin for FeedbackPolicy
impl UnwindSafe for FeedbackPolicy
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