[][src]Struct gut::index::Index

pub struct Index(_);

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.

Methods

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 CheckedIndex<usize> for Index[src]

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 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<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<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<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<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<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<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<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<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<Option<usize>> for Index[src]

impl From<MeshIndex> for Index[src]

impl From<Option<MeshIndex>> for Index[src]

impl From<Index> for MeshIndex[src]

impl From<VertexIndex> for Index[src]

impl From<Option<VertexIndex>> for Index[src]

impl From<Index> for VertexIndex[src]

impl From<EdgeIndex> for Index[src]

impl From<Option<EdgeIndex>> for Index[src]

impl From<Index> for EdgeIndex[src]

impl From<FaceIndex> for Index[src]

impl From<Option<FaceIndex>> for Index[src]

impl From<Index> for FaceIndex[src]

impl From<CellIndex> for Index[src]

impl From<Option<CellIndex>> for Index[src]

impl From<Index> for CellIndex[src]

impl From<EdgeVertexIndex> for Index[src]

impl From<Option<EdgeVertexIndex>> for Index[src]

impl From<Index> for EdgeVertexIndex[src]

impl From<FaceVertexIndex> for Index[src]

impl From<Option<FaceVertexIndex>> for Index[src]

impl From<Index> for FaceVertexIndex[src]

impl From<FaceEdgeIndex> for Index[src]

impl From<Option<FaceEdgeIndex>> for Index[src]

impl From<Index> for FaceEdgeIndex[src]

impl From<CellVertexIndex> for Index[src]

impl From<Option<CellVertexIndex>> for Index[src]

impl From<Index> for CellVertexIndex[src]

impl From<CellEdgeIndex> for Index[src]

impl From<Option<CellEdgeIndex>> for Index[src]

impl From<Index> for CellEdgeIndex[src]

impl From<CellFaceIndex> for Index[src]

impl From<Option<CellFaceIndex>> for Index[src]

impl From<Index> for CellFaceIndex[src]

impl From<VertexEdgeIndex> for Index[src]

impl From<Option<VertexEdgeIndex>> for Index[src]

impl From<Index> for VertexEdgeIndex[src]

impl From<VertexFaceIndex> for Index[src]

impl From<Option<VertexFaceIndex>> for Index[src]

impl From<Index> for VertexFaceIndex[src]

impl From<VertexCellIndex> for Index[src]

impl From<Option<VertexCellIndex>> for Index[src]

impl From<Index> for VertexCellIndex[src]

impl From<EdgeFaceIndex> for Index[src]

impl From<Option<EdgeFaceIndex>> for Index[src]

impl From<Index> for EdgeFaceIndex[src]

impl From<EdgeCellIndex> for Index[src]

impl From<Option<EdgeCellIndex>> for Index[src]

impl From<Index> for EdgeCellIndex[src]

impl From<FaceCellIndex> for Index[src]

impl From<Option<FaceCellIndex>> for Index[src]

impl From<Index> for FaceCellIndex[src]

impl Into<Option<usize>> for Index[src]

impl Clone for Index[src]

impl Copy for Index[src]

impl Default for Index[src]

impl Eq for Index[src]

impl Ord for Index[src]

impl PartialEq<Index> for Index[src]

impl PartialEq<usize> for Index[src]

impl PartialOrd<Index> for Index[src]

impl PartialOrd<usize> for Index[src]

impl Debug for Index[src]

impl Display for Index[src]

impl Div<usize> for Index[src]

type Output = Index

The resulting type after applying the / operator.

impl Rem<usize> for Index[src]

type Output = Index

The resulting type after applying the % operator.

impl Sub<usize> for Index[src]

type Output = Index

The resulting type after applying the - operator.

impl Sub<Index> for usize[src]

type Output = Index

The resulting type after applying the - operator.

impl Sub<Index> for Index[src]

type Output = Index

The resulting type after applying the - operator.

impl Add<usize> for Index[src]

type Output = Index

The resulting type after applying the + operator.

impl Add<Index> for usize[src]

type Output = Index

The resulting type after applying the + operator.

impl Add<Index> for Index[src]

type Output = Index

The resulting type after applying the + operator.

impl Mul<usize> for Index[src]

type Output = Index

The resulting type after applying the * operator.

impl Mul<Index> for usize[src]

type Output = Index

The resulting type after applying the * operator.

impl AddAssign<usize> for Index[src]

impl Hash for Index[src]

impl StructuralPartialEq for Index[src]

impl StructuralEq for Index[src]

Auto Trait Implementations

impl Send for Index

impl Sync for Index

impl Unpin for Index

impl UnwindSafe for Index

impl RefUnwindSafe for Index

Blanket Implementations

impl<T> Bytes for T[src]

impl<T> Pod for T where
    T: 'static + Copy + Send + Sync + Any
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = !

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[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]