Enum fixed_vectors::VectorError
source · [−]pub enum VectorError {
GenericError,
CannotConvertFromImproperlySizedCollection,
}
Expand description
The type returned in Result
s created by Vector functions.
Example
use fixed_vectors::{Vector2, VectorError};
use std::convert::TryFrom;
// This returns an `Err` because the given `Vec` is not as big as a `Vector2`
let try_from_vec = Vector2::try_from(vec![1]);
if let Err(error) = try_from_vec {
assert_eq!(error, VectorError::CannotConvertFromImproperlySizedCollection);
}
Variants
GenericError
Returned when there’s not enough information to give a more verbose VectorError
.
CannotConvertFromImproperlySizedCollection
Given when converting a Dynamically Sized Collection into a Vector, only when the Collection’s size is less than the Vector’s.
Example
use fixed_vectors::{Vector3, VectorError};
use std::convert::TryFrom;
let vec = vec![1, 2];
let res = Vector3::try_from(vec);
assert_eq!(res.err().unwrap(), VectorError::CannotConvertFromImproperlySizedCollection);
Trait Implementations
sourceimpl Clone for VectorError
impl Clone for VectorError
sourcefn clone(&self) -> VectorError
fn clone(&self) -> VectorError
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for VectorError
impl Debug for VectorError
sourceimpl PartialEq<VectorError> for VectorError
impl PartialEq<VectorError> for VectorError
sourcefn eq(&self, other: &VectorError) -> bool
fn eq(&self, other: &VectorError) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
impl Copy for VectorError
impl StructuralPartialEq for VectorError
Auto Trait Implementations
impl RefUnwindSafe for VectorError
impl Send for VectorError
impl Sync for VectorError
impl Unpin for VectorError
impl UnwindSafe for VectorError
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more