[−][src]Enum restor::ErrorDesc
The basic error descriptions for why a dynamically typed resource operation didn't work. It does
not contain however, the description for unit-related errors which handled with a UnitError
by
using the Unit
variant of ErrorDesc
.
Variants
BorrowedIncompatibly
Returned if there is an incompatible borrow on the contents of the unit. It follows the same
rules for runtime checking as a RefCell<T>
. Usually bundled with a Ref<T>
/RefMut<T>
in
a Result<RefVariant<T>, ErrorDesc>
.
Example:
let mut storage = DynamicStorage::new(); storage.allocate_for::<usize>(); storage.insert(0usize); let x = storage.get::<usize>().unwrap(); let y = storage.get_mut::<usize>(); assert!(y.is_err());
NoAllocatedUnit
Returned when there is no unit allocated for the type that was requested. Allocate a unit to
contain a <T>
with DynamicStorage::allocate_for::<T>(&mut self)
. Note that <T>
must be
T: Sized + Any + 'static
.
Example:
let mut storage = DynamicStorage::new(); let x = storage.get::<usize>(); assert!(x.is_err()); // Error, there is no unit for `usize` allocated! storage.allocate_for::<usize>(); storage.insert::<usize>(10); let x = storage.get::<usize>().unwrap(); assert_eq!(*x, 10);
NoMatchingType
This is an internal error that should be ignored by the user. This should never be created.
Inner(Box<ErrorDesc>)
This holds an inner ErrorDesc
. Call unwrap
on an Inner
variant to get the inner error.
Unit(UnitError)
Contains an error specific to unit operations. Please refer to the UnitError
documentation
for more information.
Methods
impl ErrorDesc
[src]
pub fn unwrap(self) -> ErrorDesc
[src]
Consumes the ErrorDesc
and returns an ErrorDesc
if it's an Inner
variant. Panics if it
is not an ErrorDesc::Inner
variant.
Trait Implementations
Auto Trait Implementations
Blanket Implementations
impl<T> From for T
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,