Struct unsegen::base::basic_types::PositiveAxisDiff [−][src]
pub struct PositiveAxisDiff<T: AxisDimension> { /* fields omitted */ }
Expand description
PositiveAxisDiff (the base for Width or Height) specifies a non-negative (or absolute) difference between two coordinate points on a terminal grid.
Implementations
impl<T: AxisDimension> PositiveAxisDiff<T>
[src]
impl<T: AxisDimension> PositiveAxisDiff<T>
[src]pub fn new_unchecked(v: i32) -> Self
[src]
pub fn new_unchecked(v: i32) -> Self
[src]Create a new PositiveAxisDiff from an i32. If v < 0 the behavior is unspecified.
Examples:
use unsegen::base::Width; let _ = Width::new_unchecked(27); //Ok let _ = Width::new_unchecked(0); //Ok // let _ = Width::new_unchecked(-37); //Not allowed!
pub fn new(v: i32) -> Result<Self, ()>
[src]
pub fn new(v: i32) -> Result<Self, ()>
[src]Try to create a new PositiveAxisDiff from an i32. If v < 0 the behavior an error value is returned.
Examples:
use unsegen::base::Width; assert!(Width::new(27).is_ok()); assert!(Width::new(0).is_ok()); assert!(Width::new(-37).is_err());
pub fn from_origin(self) -> AxisIndex<T>
[src]
pub fn from_origin(self) -> AxisIndex<T>
[src]Calculate the AxisIndex that has the specified PositiveAxisDiff to the origin (i.e., 0). Technically this just converts an AxisIndex into an PositiveAxisDiff, but is semantically more explicit.
Examples:
use unsegen::base::{ColIndex, Width}; assert_eq!(Width::new(27).unwrap().from_origin(), ColIndex::new(27));
pub fn origin_range_contains(self, i: AxisIndex<T>) -> bool
[src]
pub fn origin_range_contains(self, i: AxisIndex<T>) -> bool
[src]Check whether the given AxisIndex is in the range [0, self)
Examples:
use unsegen::base::{ColIndex, Width}; assert!(Width::new(37).unwrap().origin_range_contains(ColIndex::new(27))); assert!(Width::new(37).unwrap().origin_range_contains(ColIndex::new(0))); assert!(!Width::new(27).unwrap().origin_range_contains(ColIndex::new(27))); assert!(!Width::new(27).unwrap().origin_range_contains(ColIndex::new(37))); assert!(!Width::new(27).unwrap().origin_range_contains(ColIndex::new(-37)));
Trait Implementations
impl<T: AxisDimension, I: Into<PositiveAxisDiff<T>>> Add<I> for PositiveAxisDiff<T>
[src]
impl<T: AxisDimension, I: Into<PositiveAxisDiff<T>>> Add<I> for PositiveAxisDiff<T>
[src]impl<T: AxisDimension, I: Into<PositiveAxisDiff<T>>> AddAssign<I> for PositiveAxisDiff<T>
[src]
impl<T: AxisDimension, I: Into<PositiveAxisDiff<T>>> AddAssign<I> for PositiveAxisDiff<T>
[src]fn add_assign(&mut self, rhs: I)
[src]
fn add_assign(&mut self, rhs: I)
[src]Performs the +=
operation. Read more
impl<T: Clone + AxisDimension> Clone for PositiveAxisDiff<T>
[src]
impl<T: Clone + AxisDimension> Clone for PositiveAxisDiff<T>
[src]fn clone(&self) -> PositiveAxisDiff<T>
[src]
fn clone(&self) -> PositiveAxisDiff<T>
[src]Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]Performs copy-assignment from source
. Read more
impl<T: Debug + AxisDimension> Debug for PositiveAxisDiff<T>
[src]
impl<T: Debug + AxisDimension> Debug for PositiveAxisDiff<T>
[src]impl<T: AxisDimension> Div<i32> for PositiveAxisDiff<T>
[src]
impl<T: AxisDimension> Div<i32> for PositiveAxisDiff<T>
[src]impl<T: AxisDimension> Div<usize> for PositiveAxisDiff<T>
[src]
impl<T: AxisDimension> Div<usize> for PositiveAxisDiff<T>
[src]impl<T: AxisDimension> From<usize> for PositiveAxisDiff<T>
[src]
impl<T: AxisDimension> From<usize> for PositiveAxisDiff<T>
[src]impl<T: AxisDimension> Into<AxisDiff<T>> for PositiveAxisDiff<T>
[src]
impl<T: AxisDimension> Into<AxisDiff<T>> for PositiveAxisDiff<T>
[src]impl<T: AxisDimension> Into<i32> for PositiveAxisDiff<T>
[src]
impl<T: AxisDimension> Into<i32> for PositiveAxisDiff<T>
[src]impl<T: AxisDimension> Into<usize> for PositiveAxisDiff<T>
[src]
impl<T: AxisDimension> Into<usize> for PositiveAxisDiff<T>
[src]impl<T: AxisDimension> Mul<i32> for PositiveAxisDiff<T>
[src]
impl<T: AxisDimension> Mul<i32> for PositiveAxisDiff<T>
[src]impl<T: AxisDimension> Mul<usize> for PositiveAxisDiff<T>
[src]
impl<T: AxisDimension> Mul<usize> for PositiveAxisDiff<T>
[src]impl<T: Ord + AxisDimension> Ord for PositiveAxisDiff<T>
[src]
impl<T: Ord + AxisDimension> Ord for PositiveAxisDiff<T>
[src]impl<T: AxisDimension, I: Into<AxisDiff<T>> + Copy> PartialEq<I> for PositiveAxisDiff<T>
[src]
impl<T: AxisDimension, I: Into<AxisDiff<T>> + Copy> PartialEq<I> for PositiveAxisDiff<T>
[src]impl<T: AxisDimension, I: Into<AxisDiff<T>> + Copy> PartialOrd<I> for PositiveAxisDiff<T>
[src]
impl<T: AxisDimension, I: Into<AxisDiff<T>> + Copy> PartialOrd<I> for PositiveAxisDiff<T>
[src]fn partial_cmp(&self, other: &I) -> Option<Ordering>
[src]
fn partial_cmp(&self, other: &I) -> Option<Ordering>
[src]This method returns an ordering between self
and other
values if one exists. Read more
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]This method tests less than (for self
and other
) and is used by the <
operator. Read more
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
impl<T: AxisDimension, I: Into<PositiveAxisDiff<T>>> Rem<I> for PositiveAxisDiff<T>
[src]
impl<T: AxisDimension, I: Into<PositiveAxisDiff<T>>> Rem<I> for PositiveAxisDiff<T>
[src]impl<T: AxisDimension, I: Into<AxisDiff<T>>> Sub<I> for PositiveAxisDiff<T>
[src]
impl<T: AxisDimension, I: Into<AxisDiff<T>>> Sub<I> for PositiveAxisDiff<T>
[src]impl<'a, T: 'a + AxisDimension + PartialOrd + Ord> Sum<&'a PositiveAxisDiff<T>> for PositiveAxisDiff<T>
[src]
impl<'a, T: 'a + AxisDimension + PartialOrd + Ord> Sum<&'a PositiveAxisDiff<T>> for PositiveAxisDiff<T>
[src]impl<T: AxisDimension + PartialOrd + Ord> Sum<PositiveAxisDiff<T>> for PositiveAxisDiff<T>
[src]
impl<T: AxisDimension + PartialOrd + Ord> Sum<PositiveAxisDiff<T>> for PositiveAxisDiff<T>
[src]impl<T: Copy + AxisDimension> Copy for PositiveAxisDiff<T>
[src]
impl<T: Eq + AxisDimension> Eq for PositiveAxisDiff<T>
[src]
impl<T: AxisDimension> StructuralEq for PositiveAxisDiff<T>
[src]
Auto Trait Implementations
impl<T> RefUnwindSafe for PositiveAxisDiff<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Send for PositiveAxisDiff<T> where
T: Send,
T: Send,
impl<T> Sync for PositiveAxisDiff<T> where
T: Sync,
T: Sync,
impl<T> Unpin for PositiveAxisDiff<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for PositiveAxisDiff<T> where
T: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn to_owned(&self) -> T
[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)
[src]
pub fn clone_into(&self, target: &mut T)
[src]🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more