pub enum RemoveError {
IndexOutOfBounds {
index: NonZeroUsize,
len: NonZeroUsize,
},
WouldBecomeEmpty,
Both {
index: NonZeroUsize,
len: NonZeroUsize,
},
}Available on crate feature
alloc only.Expand description
Error returned when removing an element fails.
Variants§
IndexOutOfBounds
The index is greater or equal to the number of elements.
Fields
§
index: NonZeroUsizeThe index used for attempted access.
§
len: NonZeroUsizeThe total number of elements stored.
WouldBecomeEmpty
Removing the element would leave an empty vec.
Both
Both the index is out of bounds and the vec would become empty after removing the element.
Fields
§
index: NonZeroUsizeThe index used for attempted access.
§
len: NonZeroUsizeThe total number of elements stored.
Implementations§
Source§impl RemoveError
impl RemoveError
Sourcepub fn is_oob(&self) -> bool
pub fn is_oob(&self) -> bool
Returns true if there was out-of-bounds access.
Note that this also returns true for the Both variant.
Sourcepub fn is_would_become_empty(&self) -> bool
pub fn is_would_become_empty(&self) -> bool
Returns true if the resulting vec would become empty after removing the element.
Note that this also returns true for the Both variant.
Trait Implementations§
Source§impl Clone for RemoveError
impl Clone for RemoveError
Source§fn clone(&self) -> RemoveError
fn clone(&self) -> RemoveError
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 moreSource§impl Debug for RemoveError
impl Debug for RemoveError
Source§impl Display for RemoveError
impl Display for RemoveError
Source§impl Error for RemoveError
Available on crate feature std, or crate feature newer-rust and rust_version=">= 1.81" only.
impl Error for RemoveError
Available on crate feature
std, or crate feature newer-rust and rust_version=">= 1.81" only.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 Copy for RemoveError
Auto Trait Implementations§
impl Freeze for RemoveError
impl RefUnwindSafe for RemoveError
impl Send for RemoveError
impl Sync for RemoveError
impl Unpin for RemoveError
impl UnwindSafe for RemoveError
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