pub struct StaggerRecoveryPolicy { /* private fields */ }Expand description
Immutable recovery policy. Default is zero grace (the legacy rule). During positive grace, poise hits are rejected rather than accumulated.
Implementations§
Source§impl StaggerRecoveryPolicy
impl StaggerRecoveryPolicy
Sourcepub fn reject_during_grace(
grace_seconds: f32,
) -> Result<StaggerRecoveryPolicy, LoopError>
pub fn reject_during_grace( grace_seconds: f32, ) -> Result<StaggerRecoveryPolicy, LoopError>
Validate a finite grace duration in 0..=3600 simulation seconds.
Zero disables grace. No existing stagger is mutated on failure.
use ferravex_play::gameplay::stagger::StaggerRecoveryPolicy;
assert_eq!(StaggerRecoveryPolicy::default().grace_seconds(), 0.0);
assert!(StaggerRecoveryPolicy::reject_during_grace(f32::NAN).is_err());
let policy = StaggerRecoveryPolicy::reject_during_grace(0.25).unwrap();
assert_eq!(policy.grace_seconds(), 0.25);Sourcepub fn grace_seconds(&self) -> f64
pub fn grace_seconds(&self) -> f64
Authored grace seconds, represented exactly from the supplied f32.
Trait Implementations§
Source§impl Clone for StaggerRecoveryPolicy
impl Clone for StaggerRecoveryPolicy
Source§fn clone(&self) -> StaggerRecoveryPolicy
fn clone(&self) -> StaggerRecoveryPolicy
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 StaggerRecoveryPolicy
impl Debug for StaggerRecoveryPolicy
Source§impl Default for StaggerRecoveryPolicy
impl Default for StaggerRecoveryPolicy
Source§fn default() -> StaggerRecoveryPolicy
fn default() -> StaggerRecoveryPolicy
Returns the “default value” for a type. Read more
Source§impl PartialEq for StaggerRecoveryPolicy
impl PartialEq for StaggerRecoveryPolicy
impl Copy for StaggerRecoveryPolicy
impl StructuralPartialEq for StaggerRecoveryPolicy
Auto Trait Implementations§
impl Freeze for StaggerRecoveryPolicy
impl RefUnwindSafe for StaggerRecoveryPolicy
impl Send for StaggerRecoveryPolicy
impl Sync for StaggerRecoveryPolicy
impl Unpin for StaggerRecoveryPolicy
impl UnwindSafe for StaggerRecoveryPolicy
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