Struct gut::index::Index [−][src]
A possibly invalid unsigned index.
The maximum usize
integer represents an invalid index.
This index type is ideal for storage.
Overflow is not handled by this type. Instead we rely on Rust's internal overflow panics during
debug builds.
Implementations
impl Index
[src]
pub const INVALID: Index
[src]
Invalid index instance.
pub fn new(i: usize) -> Index
[src]
Create a valid index from a usize type. This constructor does the necessary check for debug builds only.
pub fn into_option(self) -> Option<usize>
[src]
Convert this Index
into Option<usize>
, which is a larger struct.
pub fn map_inner<F: FnOnce(usize) -> usize>(self, f: F) -> Index
[src]
Manipulate the inner representation of the index. This method avoids the additional check
used in map
. Use this to opt out of automatic index checking.
pub fn and_then<F: FnOnce(usize) -> Index>(self, f: F) -> Index
[src]
Checked and_then
over inner index. This allows operations on valid indices only.
pub fn apply<F: FnOnce(&mut usize)>(&mut self, f: F)
[src]
Apply a function to the inner usize
index. The index remains unchanged if invalid.
pub fn if_valid<F: FnOnce(usize)>(self, f: F)
[src]
Apply a function to the inner usize
index.
pub fn into_inner(self) -> usize
[src]
Get the raw usize
representation of this Index. This may be useful for performance
critical code or debugging.
Trait Implementations
impl Add<Index> for Index
[src]
type Output = Index
The resulting type after applying the +
operator.
fn add(self, rhs: Index) -> Index
[src]
impl Add<usize> for Index
[src]
type Output = Index
The resulting type after applying the +
operator.
fn add(self, rhs: usize) -> Index
[src]
impl AddAssign<usize> for Index
[src]
fn add_assign(&mut self, rhs: usize)
[src]
impl CheckedIndex<usize> for Index
[src]
fn invalid() -> Self
[src]
fn is_valid(&self) -> bool
[src]
fn unwrap(self) -> usize
[src]
fn expect(self, msg: &str) -> usize
[src]
fn map<F: FnOnce(usize) -> usize>(self, f: F) -> Index
[src]
fn map_or<U, F: FnOnce(usize) -> U>(self, default: U, f: F) -> U
[src]
fn into_inner(self) -> usize
[src]
impl Clone for Index
[src]
impl Copy for Index
[src]
impl Debug for Index
[src]
impl Default for Index
[src]
impl Display for Index
[src]
impl Div<usize> for Index
[src]
type Output = Index
The resulting type after applying the /
operator.
fn div(self, rhs: usize) -> Index
[src]
impl Eq for Index
[src]
impl From<CellEdgeIndex> for Index
[src]
fn from(i: CellEdgeIndex) -> Self
[src]
impl From<CellFaceIndex> for Index
[src]
fn from(i: CellFaceIndex) -> Self
[src]
impl From<CellIndex> for Index
[src]
impl From<CellVertexIndex> for Index
[src]
fn from(i: CellVertexIndex) -> Self
[src]
impl From<EdgeCellIndex> for Index
[src]
fn from(i: EdgeCellIndex) -> Self
[src]
impl From<EdgeFaceIndex> for Index
[src]
fn from(i: EdgeFaceIndex) -> Self
[src]
impl From<EdgeIndex> for Index
[src]
impl From<EdgeVertexIndex> for Index
[src]
fn from(i: EdgeVertexIndex) -> Self
[src]
impl From<FaceCellIndex> for Index
[src]
fn from(i: FaceCellIndex) -> Self
[src]
impl From<FaceEdgeIndex> for Index
[src]
fn from(i: FaceEdgeIndex) -> Self
[src]
impl From<FaceIndex> for Index
[src]
impl From<FaceVertexIndex> for Index
[src]
fn from(i: FaceVertexIndex) -> Self
[src]
impl From<Index> for MeshIndex
[src]
impl From<Index> for VertexIndex
[src]
impl From<Index> for CellFaceIndex
[src]
impl From<Index> for VertexEdgeIndex
[src]
impl From<Index> for VertexFaceIndex
[src]
impl From<Index> for VertexCellIndex
[src]
impl From<Index> for EdgeFaceIndex
[src]
impl From<Index> for EdgeCellIndex
[src]
impl From<Index> for FaceCellIndex
[src]
impl From<Index> for EdgeIndex
[src]
impl From<Index> for FaceIndex
[src]
impl From<Index> for CellIndex
[src]
impl From<Index> for EdgeVertexIndex
[src]
impl From<Index> for FaceVertexIndex
[src]
impl From<Index> for FaceEdgeIndex
[src]
impl From<Index> for CellVertexIndex
[src]
impl From<Index> for CellEdgeIndex
[src]
impl From<MeshIndex> for Index
[src]
impl From<Option<CellEdgeIndex>> for Index
[src]
fn from(mb_i: Option<CellEdgeIndex>) -> Self
[src]
impl From<Option<CellFaceIndex>> for Index
[src]
fn from(mb_i: Option<CellFaceIndex>) -> Self
[src]
impl From<Option<CellIndex>> for Index
[src]
impl From<Option<CellVertexIndex>> for Index
[src]
fn from(mb_i: Option<CellVertexIndex>) -> Self
[src]
impl From<Option<EdgeCellIndex>> for Index
[src]
fn from(mb_i: Option<EdgeCellIndex>) -> Self
[src]
impl From<Option<EdgeFaceIndex>> for Index
[src]
fn from(mb_i: Option<EdgeFaceIndex>) -> Self
[src]
impl From<Option<EdgeIndex>> for Index
[src]
impl From<Option<EdgeVertexIndex>> for Index
[src]
fn from(mb_i: Option<EdgeVertexIndex>) -> Self
[src]
impl From<Option<FaceCellIndex>> for Index
[src]
fn from(mb_i: Option<FaceCellIndex>) -> Self
[src]
impl From<Option<FaceEdgeIndex>> for Index
[src]
fn from(mb_i: Option<FaceEdgeIndex>) -> Self
[src]
impl From<Option<FaceIndex>> for Index
[src]
impl From<Option<FaceVertexIndex>> for Index
[src]
fn from(mb_i: Option<FaceVertexIndex>) -> Self
[src]
impl From<Option<MeshIndex>> for Index
[src]
impl From<Option<VertexCellIndex>> for Index
[src]
fn from(mb_i: Option<VertexCellIndex>) -> Self
[src]
impl From<Option<VertexEdgeIndex>> for Index
[src]
fn from(mb_i: Option<VertexEdgeIndex>) -> Self
[src]
impl From<Option<VertexFaceIndex>> for Index
[src]
fn from(mb_i: Option<VertexFaceIndex>) -> Self
[src]
impl From<Option<VertexIndex>> for Index
[src]
fn from(mb_i: Option<VertexIndex>) -> Self
[src]
impl From<Option<usize>> for Index
[src]
impl From<VertexCellIndex> for Index
[src]
fn from(i: VertexCellIndex) -> Self
[src]
impl From<VertexEdgeIndex> for Index
[src]
fn from(i: VertexEdgeIndex) -> Self
[src]
impl From<VertexFaceIndex> for Index
[src]
fn from(i: VertexFaceIndex) -> Self
[src]
impl From<VertexIndex> for Index
[src]
fn from(i: VertexIndex) -> Self
[src]
impl From<i16> for Index
[src]
Create an index from a signed integer type. If the given argument is negative, the created index will be invalid.
impl From<i32> for Index
[src]
Create an index from a signed integer type. If the given argument is negative, the created index will be invalid.
impl From<i64> for Index
[src]
Create an index from a signed integer type. If the given argument is negative, the created index will be invalid.
impl From<i8> for Index
[src]
Create an index from a signed integer type. If the given argument is negative, the created index will be invalid.
impl From<isize> for Index
[src]
Create an index from a signed integer type. If the given argument is negative, the created index will be invalid.
impl From<u16> for Index
[src]
Create a valid index from a usize
type. This converter does the necessary bounds
check for debug builds only.
impl From<u32> for Index
[src]
Create a valid index from a usize
type. This converter does the necessary bounds
check for debug builds only.
impl From<u64> for Index
[src]
Create a valid index from a usize
type. This converter does the necessary bounds
check for debug builds only.
impl From<u8> for Index
[src]
Create a valid index from a usize
type. This converter does the necessary bounds
check for debug builds only.
impl From<usize> for Index
[src]
Create a valid index from a usize
type. This converter does the necessary bounds
check for debug builds only.
impl Hash for Index
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl Into<Option<usize>> for Index
[src]
impl IntoIterator for Index
[src]
type Item = usize
The type of the elements being iterated over.
type IntoIter = IntoIter<usize>
Which kind of iterator are we turning this into?
fn into_iter(self) -> Self::IntoIter
[src]
impl Mul<usize> for Index
[src]
type Output = Index
The resulting type after applying the *
operator.
fn mul(self, rhs: usize) -> Index
[src]
impl Ord for Index
[src]
fn cmp(&self, other: &Index) -> Ordering
[src]
#[must_use]pub fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn clamp(self, min: Self, max: Self) -> Self
1.50.0[src]
impl PartialEq<Index> for Index
[src]
impl PartialEq<usize> for Index
[src]
impl PartialOrd<Index> for Index
[src]
fn partial_cmp(&self, other: &Index) -> Option<Ordering>
[src]
fn lt(&self, other: &Index) -> bool
[src]
fn le(&self, other: &Index) -> bool
[src]
fn gt(&self, other: &Index) -> bool
[src]
fn ge(&self, other: &Index) -> bool
[src]
impl PartialOrd<usize> for Index
[src]
fn partial_cmp(&self, other: &usize) -> Option<Ordering>
[src]
#[must_use]pub fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl Pod for Index
[src]
impl Rem<usize> for Index
[src]
type Output = Index
The resulting type after applying the %
operator.
fn rem(self, rhs: usize) -> Index
[src]
impl StructuralEq for Index
[src]
impl StructuralPartialEq for Index
[src]
impl Sub<Index> for Index
[src]
type Output = Index
The resulting type after applying the -
operator.
fn sub(self, rhs: Index) -> Index
[src]
impl Sub<usize> for Index
[src]
type Output = Index
The resulting type after applying the -
operator.
fn sub(self, rhs: usize) -> Index
[src]
impl Zeroable for Index
[src]
Auto Trait Implementations
impl RefUnwindSafe for Index
[src]
impl Send for Index
[src]
impl Sync for Index
[src]
impl Unpin for Index
[src]
impl UnwindSafe for Index
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> AsSlice<T> for T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> CallHasher for T where
T: Hash,
T: Hash,
impl<T> CloneBytes for T where
T: 'static + Clone,
[src]
T: 'static + Clone,
pub unsafe fn clone_bytes(
src: &[MaybeUninit<u8>]
) -> Box<[MaybeUninit<u8>], Global>
[src]
src: &[MaybeUninit<u8>]
) -> Box<[MaybeUninit<u8>], Global>
pub unsafe fn clone_from_bytes(
dst: &mut [MaybeUninit<u8>],
src: &[MaybeUninit<u8>]
)
[src]
dst: &mut [MaybeUninit<u8>],
src: &[MaybeUninit<u8>]
)
pub unsafe fn clone_into_raw_bytes(
src: &[MaybeUninit<u8>],
dst: &mut [MaybeUninit<u8>]
)
[src]
src: &[MaybeUninit<u8>],
dst: &mut [MaybeUninit<u8>]
)
impl<T> CopyElem for T where
T: Any + Copy,
[src]
T: Any + Copy,
impl<T> DebugBytes for T where
T: 'static + Debug,
[src]
T: 'static + Debug,
pub unsafe fn fmt_bytes(
bytes: &[MaybeUninit<u8>],
f: &mut Formatter<'_>
) -> Result<(), Error>
[src]
bytes: &[MaybeUninit<u8>],
f: &mut Formatter<'_>
) -> Result<(), Error>
impl<T> Downcast for T where
T: Any,
T: Any,
pub fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
pub fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
pub fn as_any(&self) -> &(dyn Any + 'static)
pub fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
impl<T> DowncastSync for T where
T: Send + Sync + Any,
T: Send + Sync + Any,
impl<T> DropBytes for T where
T: 'static,
[src]
T: 'static,
pub unsafe fn drop_bytes(bytes: &mut [MaybeUninit<u8>])
[src]
impl<T> Elem for T where
T: Any + DropBytes,
[src]
T: Any + DropBytes,
impl<T> From<T> for T
[src]
impl<'a, S, I> Get<'a, I> for S where
I: GetIndex<'a, S>,
[src]
I: GetIndex<'a, S>,
type Output = <I as GetIndex<'a, S>>::Output
pub fn get(&self, idx: I) -> Option<<I as GetIndex<'a, S>>::Output>
[src]
pub fn at(&self, idx: I) -> Self::Output
[src]
impl<T> HashBytes for T where
T: 'static + Hash,
[src]
T: 'static + Hash,
pub unsafe fn hash_bytes(bytes: &[MaybeUninit<u8>], state: &mut dyn Hasher)
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<S, I> Isolate<I> for S where
I: IsolateIndex<S>,
[src]
I: IsolateIndex<S>,
type Output = <I as IsolateIndex<S>>::Output
pub unsafe fn isolate_unchecked(self, idx: I) -> <S as Isolate<I>>::Output
[src]
pub fn try_isolate(self, idx: I) -> Option<<S as Isolate<I>>::Output>
[src]
pub fn isolate(self, idx: I) -> Self::Output
[src]
impl<T, Rhs, Output> NumOps<Rhs, Output> for T where
T: Sub<Rhs, Output = Output> + Mul<Rhs, Output = Output> + Div<Rhs, Output = Output> + Add<Rhs, Output = Output> + Rem<Rhs, Output = Output>,
[src]
T: Sub<Rhs, Output = Output> + Mul<Rhs, Output = Output> + Div<Rhs, Output = Output> + Add<Rhs, Output = Output> + Rem<Rhs, Output = Output>,
impl<T> PartialEqBytes for T where
T: 'static + PartialEq<T>,
[src]
T: 'static + PartialEq<T>,
impl<T> Pod for T where
T: 'static + Copy + Send + Sync + Any,
[src]
T: 'static + Copy + Send + Sync + Any,
impl<T> Pointable for T
pub const ALIGN: usize
type Init = T
The type for initializers.
pub unsafe fn init(init: <T as Pointable>::Init) -> usize
pub unsafe fn deref<'a>(ptr: usize) -> &'a T
pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
pub unsafe fn drop(ptr: usize)
impl<T, N> PushArrayToVec<N> for T where
T: Clone,
N: Array<T>,
[src]
T: Clone,
N: Array<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,