pub struct RefValue<T>(_, _);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> 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