pub struct Const<T>(pub T);
Expand description
The same value every time.
In general, using a lambda has fewer restrictions than using
Const
, because you can avoid the Clone
requirement on
your type.
Example:
use boulder::{Const, Generator};
let mut g = Const(1);
assert_eq!(g.generate(), 1);
assert_eq!(g.generate(), 1);
assert_eq!(g.generate(), 1);
Tuple Fields
0: T
Implementations
Trait Implementations
sourceimpl<C, T> GeneratorWithPersianRug<C> for Const<T> where
T: Clone + 'static,
C: Context,
impl<C, T> GeneratorWithPersianRug<C> for Const<T> where
T: Clone + 'static,
C: Context,
Auto Trait Implementations
impl<T> RefUnwindSafe for Const<T> where
T: RefUnwindSafe,
impl<T> Send for Const<T> where
T: Send,
impl<T> Sync for Const<T> where
T: Sync,
impl<T> Unpin for Const<T> where
T: Unpin,
impl<T> UnwindSafe for Const<T> where
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more