pub struct RefValue<T>(/* private fields */);
Expand description
RefValue
means reference of value or refreshable value,
it holds a value which can be updated when Configuration
is refreshed.
It implements FromConfig
, user can use it in auto deriving config objects.
But it is not supporting recursively usage, following example will cause runtime error:
ⓘ
#[derive(FromConfig)]
struct A {
ref_b: RefValue<B>,
}
#[derive(FromConfig)]
struct B {
ref_c: RefValue<u8>,
}
Implementations§
Trait Implementations§
Source§impl<T: FromConfig + Send + 'static> FromConfig for RefValue<T>
impl<T: FromConfig + Send + 'static> FromConfig for RefValue<T>
Source§fn from_config(
context: &mut ConfigContext<'_>,
value: Option<ConfigValue<'_>>,
) -> Result<Self, ConfigError>
fn from_config( context: &mut ConfigContext<'_>, value: Option<ConfigValue<'_>>, ) -> Result<Self, ConfigError>
Generate config from
ConfigValue
under context.Auto Trait Implementations§
impl<T> Freeze for RefValue<T>
impl<T> RefUnwindSafe for RefValue<T>
impl<T> Send for RefValue<T>where
T: Send,
impl<T> Sync for RefValue<T>where
T: Send,
impl<T> Unpin for RefValue<T>
impl<T> UnwindSafe for RefValue<T>
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