pub struct ConstantSource(pub f64);Expand description
A constant source that always returns the same value.
This is the simplest source type - it always produces the same value regardless of context.
§Examples
use zzstat::source::{ConstantSource, StatSource};
use zzstat::{StatId, StatContext};
let source = ConstantSource(100.0);
let context = StatContext::new();
let stat_id = StatId::from_str("HP");
assert_eq!(source.get_value(&stat_id, &context), 100.0);Tuple Fields§
§0: f64Trait Implementations§
Source§impl Clone for ConstantSource
impl Clone for ConstantSource
Source§fn clone(&self) -> ConstantSource
fn clone(&self) -> ConstantSource
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 ConstantSource
impl Debug for ConstantSource
Source§impl StatSource for ConstantSource
impl StatSource for ConstantSource
Auto Trait Implementations§
impl Freeze for ConstantSource
impl RefUnwindSafe for ConstantSource
impl Send for ConstantSource
impl Sync for ConstantSource
impl Unpin for ConstantSource
impl UnwindSafe for ConstantSource
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