pub struct CustomVal(/* private fields */);Expand description
Contains a custom value.
Implementations§
Source§impl CustomVal
impl CustomVal
Sourcepub fn new(val: impl CustomType) -> CustomVal
pub fn new(val: impl CustomType) -> CustomVal
Create a new CustomVal from any type that implements CustomType.
Sourcepub fn get<T>(&self) -> Result<CustomValRef<'_, T>, CustomValError>where
T: CustomType,
pub fn get<T>(&self) -> Result<CustomValRef<'_, T>, CustomValError>where
T: CustomType,
Get the underlying value of Self if it is of type T or else return None.
§Panic
Panics if the value if the value is under a Self::get_mut.
Sourcepub fn get_mut<T>(&self) -> Result<CustomValMut<'_, T>, CustomValError>where
T: CustomType,
pub fn get_mut<T>(&self) -> Result<CustomValMut<'_, T>, CustomValError>where
T: CustomType,
Get the underlying value of Self if it is of type T or else return None.
§Panic
Panics if the value if the value is under a Self::get or Self::get_mut.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for CustomVal
impl RefUnwindSafe for CustomVal
impl Send for CustomVal
impl Sync for CustomVal
impl Unpin for CustomVal
impl UnwindSafe for CustomVal
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
Source§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
Fallible version of
ToCompactString::to_compact_string() Read moreSource§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
Converts the given value to a
CompactString. Read more