Enum ResourceUpdateError
pub enum ResourceUpdateError<E> {
Resource(ResourceError),
Update {
type_name: &'static str,
source: E,
},
}Expand description
A missing resource or the original error returned by a checked update.
The updater’s error needs no trait bounds to be returned. When it implements
std::error::Error and is 'static, it is also exposed as the error source.
See Resources::try_update for the replacement and side-effect guarantees.
use ferravex_engine::resources::{ResourceError, ResourceUpdateError, Resources};
let mut resources = Resources::default();
let result = resources.try_update::<u32, ()>(|_| panic!("missing resource"));
assert_eq!(result, Err(ResourceUpdateError::Resource(ResourceError::Missing {
type_name: std::any::type_name::<u32>(),
})));Variants§
Resource(ResourceError)
The resource was missing, so the updater did not run.
Update
The updater failed; the stored resource was not replaced.
Trait Implementations§
§impl<E> Clone for ResourceUpdateError<E>where
E: Clone,
impl<E> Clone for ResourceUpdateError<E>where
E: Clone,
§fn clone(&self) -> ResourceUpdateError<E>
fn clone(&self) -> ResourceUpdateError<E>
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 more§impl<E> Debug for ResourceUpdateError<E>where
E: Debug,
impl<E> Debug for ResourceUpdateError<E>where
E: Debug,
§impl<E> Display for ResourceUpdateError<E>where
E: Display,
impl<E> Display for ResourceUpdateError<E>where
E: Display,
§impl<E> Error for ResourceUpdateError<E>where
E: Error + 'static,
impl<E> Error for ResourceUpdateError<E>where
E: Error + 'static,
§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
§impl<E> PartialEq for ResourceUpdateError<E>where
E: PartialEq,
impl<E> PartialEq for ResourceUpdateError<E>where
E: PartialEq,
impl<E> Eq for ResourceUpdateError<E>where
E: Eq,
impl<E> StructuralPartialEq for ResourceUpdateError<E>
Auto Trait Implementations§
impl<E> Freeze for ResourceUpdateError<E>where
E: Freeze,
impl<E> RefUnwindSafe for ResourceUpdateError<E>where
E: RefUnwindSafe,
impl<E> Send for ResourceUpdateError<E>where
E: Send,
impl<E> Sync for ResourceUpdateError<E>where
E: Sync,
impl<E> Unpin for ResourceUpdateError<E>where
E: Unpin,
impl<E> UnwindSafe for ResourceUpdateError<E>where
E: 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