[][src]Struct unsegen::base::basic_types::AxisIndex

pub struct AxisIndex<T: AxisDimension> { /* fields omitted */ }

AxisIndex (the base for ColIndex or RowIndex) is a signed integer coordinate (i.e., a coordinate of a point on the terminal cell grid)

Implementations

impl<T: AxisDimension> AxisIndex<T>[src]

pub fn new(v: i32) -> Self[src]

Create a new AxisIndex from an i32. Any i32 value is valid.

pub fn raw_value(self) -> i32[src]

Unpack the AxisDiff to receive the raw i32 value.

pub fn diff_to_origin(self) -> AxisDiff<T>[src]

Calculate the origin of the Index to the origin of the coordinate grid (i.e., 0). Technically this just converts an AxisIndex into an AxisDiff, but is semantically more explicit.

Examples:

use unsegen::base::{ColIndex, ColDiff};
assert_eq!(ColIndex::new(27).diff_to_origin(), ColDiff::new(27));

pub fn positive_or_zero(self) -> AxisIndex<T>[src]

Clamp the value into a positive or zero range

Examples:

use unsegen::base::ColIndex;
assert_eq!(ColIndex::new(27).positive_or_zero(), ColIndex::new(27));
assert_eq!(ColIndex::new(0).positive_or_zero(), ColIndex::new(0));
assert_eq!(ColIndex::new(-37).positive_or_zero(), ColIndex::new(0));

Trait Implementations

impl<T: AxisDimension, I: Into<AxisDiff<T>>> Add<I> for AxisIndex<T>[src]

type Output = Self

The resulting type after applying the + operator.

impl<T: AxisDimension, I: Into<AxisDiff<T>>> AddAssign<I> for AxisIndex<T>[src]

impl<T: Clone + AxisDimension> Clone for AxisIndex<T>[src]

impl<T: Copy + AxisDimension> Copy for AxisIndex<T>[src]

impl<T: Debug + AxisDimension> Debug for AxisIndex<T>[src]

impl<T: Eq + AxisDimension> Eq for AxisIndex<T>[src]

impl<T: AxisDimension> From<i32> for AxisIndex<T>[src]

impl<T: AxisDimension> Into<i32> for AxisIndex<T>[src]

impl<T: AxisDimension> Into<isize> for AxisIndex<T>[src]

impl<T: AxisDimension> Neg for AxisIndex<T>[src]

type Output = Self

The resulting type after applying the - operator.

impl<T: Ord + AxisDimension> Ord for AxisIndex<T>[src]

impl<T: AxisDimension, I: Into<AxisIndex<T>> + Copy> PartialEq<I> for AxisIndex<T>[src]

impl<T: AxisDimension, I: Into<AxisIndex<T>> + Copy> PartialOrd<I> for AxisIndex<T>[src]

impl<T: AxisDimension, I: Into<AxisIndex<T>>> Rem<I> for AxisIndex<T>[src]

type Output = Self

The resulting type after applying the % operator.

impl<T: AxisDimension> StructuralEq for AxisIndex<T>[src]

impl<T: AxisDimension> Sub<AxisIndex<T>> for AxisIndex<T>[src]

type Output = AxisDiff<T>

The resulting type after applying the - operator.

impl<T: AxisDimension, I: Into<AxisDiff<T>>> Sub<I> for AxisIndex<T>[src]

type Output = Self

The resulting type after applying the - operator.

impl<T: AxisDimension, I: Into<AxisDiff<T>>> SubAssign<I> for AxisIndex<T>[src]

Auto Trait Implementations

impl<T> RefUnwindSafe for AxisIndex<T> where
    T: RefUnwindSafe

impl<T> Send for AxisIndex<T> where
    T: Send

impl<T> Sync for AxisIndex<T> where
    T: Sync

impl<T> Unpin for AxisIndex<T> where
    T: Unpin

impl<T> UnwindSafe for AxisIndex<T> where
    T: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

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

impl<T> BorrowMut<T> for T where
    T: ?Sized
[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, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

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.