pub struct ConfigValHandle<T> {
pub(crate) val: ConfigValAtomic,
pub(crate) _type: PhantomData<T>,
}
Expand description
A handle to a configuration value in a ConfigSet
.
Allows users to amortize the lookup of a name within a set.
Handles can be cheaply cloned.
Fields§
§val: ConfigValAtomic
§_type: PhantomData<T>
Implementations§
Source§impl<T: ConfigType> ConfigValHandle<T>
impl<T: ConfigType> ConfigValHandle<T>
Sourcepub fn get(&self) -> T
pub fn get(&self) -> T
Returns the latest value of this config within the set associated with the handle.
Sourcepub fn disconnected<X>(value: X) -> Selfwhere
X: ConfigDefault<ConfigType = T>,
pub fn disconnected<X>(value: X) -> Selfwhere
X: ConfigDefault<ConfigType = T>,
Return a new handle that returns the constant value provided, generally for testing.
Trait Implementations§
Source§impl<T: Clone> Clone for ConfigValHandle<T>
impl<T: Clone> Clone for ConfigValHandle<T>
Source§fn clone(&self) -> ConfigValHandle<T>
fn clone(&self) -> ConfigValHandle<T>
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 moreAuto Trait Implementations§
impl<T> Freeze for ConfigValHandle<T>
impl<T> RefUnwindSafe for ConfigValHandle<T>where
T: RefUnwindSafe,
impl<T> Send for ConfigValHandle<T>where
T: Send,
impl<T> Sync for ConfigValHandle<T>where
T: Sync,
impl<T> Unpin for ConfigValHandle<T>where
T: Unpin,
impl<T> UnwindSafe for ConfigValHandle<T>where
T: UnwindSafe,
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