Enum ResourceAccessError
pub enum ResourceAccessError {
Duplicate {
type_name: &'static str,
first: usize,
second: usize,
},
Missing {
type_name: &'static str,
index: usize,
},
}Expand description
A disjoint resource request repeated a type or requested an absent type.
Indices are zero-based positions in the generic type list and callback
arguments. All duplicate checks precede presence checks, even if a repeated
type is absent. The first repeated position wins; first names its earliest
occurrence. Otherwise the first missing position wins. Type aliases count as
the same type; distinct newtypes can represent separate roles.
These errors never invoke the callback or change the store. The existing
single-resource ResourceError remains separate and unchanged.
use ferravex_engine::resources::{ResourceAccessError, Resources};
type Score = u32;
let mut resources = Resources::default();
assert_eq!(resources.with2_mut::<u32, Score, ()>(|_, _| panic!("not called")),
Err(ResourceAccessError::Duplicate {
type_name: std::any::type_name::<u32>(), first: 0, second: 1,
}));
assert_eq!(resources.with2_mut_ref::<u32, u64, ()>(|_, _| panic!("not called")),
Err(ResourceAccessError::Missing {
type_name: std::any::type_name::<u32>(), index: 0,
}));Variants§
Duplicate
A type occurs more than once, regardless of shared/mutable access mode.
Missing
Insert or initialize this type before requesting the group.
Trait Implementations§
§impl Clone for ResourceAccessError
impl Clone for ResourceAccessError
§fn clone(&self) -> ResourceAccessError
fn clone(&self) -> ResourceAccessError
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 Debug for ResourceAccessError
impl Debug for ResourceAccessError
§impl Display for ResourceAccessError
impl Display for ResourceAccessError
§impl Error for ResourceAccessError
impl Error for ResourceAccessError
1.30.0 · Source§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 PartialEq for ResourceAccessError
impl PartialEq for ResourceAccessError
impl Copy for ResourceAccessError
impl Eq for ResourceAccessError
impl StructuralPartialEq for ResourceAccessError
Auto Trait Implementations§
impl Freeze for ResourceAccessError
impl RefUnwindSafe for ResourceAccessError
impl Send for ResourceAccessError
impl Sync for ResourceAccessError
impl Unpin for ResourceAccessError
impl UnwindSafe for ResourceAccessError
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