[][src]Trait lz_diet::AdjacentBound

pub trait AdjacentBound: Ord {
    fn is_immediately_before(&self, other: &Self) -> bool;
fn is_immediately_after(&self, other: &Self) -> bool;
fn increment(&self) -> Self;
fn decrement(&self) -> Self;
fn increment_ref(&mut self);
fn decrement_ref(&mut self); fn is_adjacent(&self, other: &Self) -> bool { ... } }

For types which have adjacent values.

Required methods

fn is_immediately_before(&self, other: &Self) -> bool

Determines whether self is immediately before other.

use lz_diet::AdjacentBound;

assert!(5u32.is_immediately_before(&6));
assert_eq!(5u32.is_immediately_before(&7), false);

fn is_immediately_after(&self, other: &Self) -> bool

Determines whether self is immediately after other.

use lz_diet::AdjacentBound;

assert!(6u32.is_immediately_after(&5));
assert_eq!(7u32.is_immediately_after(&5), false);

fn increment(&self) -> Self

Returns a new value which is self incremented.

use lz_diet::AdjacentBound;

assert_eq!(6u32.increment(), 7);

fn decrement(&self) -> Self

Returns a new value which is self decremented.

use lz_diet::AdjacentBound;

assert_eq!(6u32.decrement(), 5);

fn increment_ref(&mut self)

Increments self in place.

use lz_diet::AdjacentBound;

let mut value = 6u32;
value.increment_ref();
assert_eq!(value, 7);

fn decrement_ref(&mut self)

Decrements self in place.

use lz_diet::AdjacentBound;

let mut value = 6u32;
value.decrement_ref();
assert_eq!(value, 5);
Loading content...

Provided methods

fn is_adjacent(&self, other: &Self) -> bool

Determines whether self and other are adjacent.

Loading content...

Implementations on Foreign Types

impl AdjacentBound for u8[src]

impl AdjacentBound for Wrapping<u8>[src]

impl AdjacentBound for i8[src]

impl AdjacentBound for Wrapping<i8>[src]

impl AdjacentBound for u16[src]

impl AdjacentBound for Wrapping<u16>[src]

impl AdjacentBound for i16[src]

impl AdjacentBound for Wrapping<i16>[src]

impl AdjacentBound for u32[src]

impl AdjacentBound for Wrapping<u32>[src]

impl AdjacentBound for i32[src]

impl AdjacentBound for Wrapping<i32>[src]

impl AdjacentBound for u64[src]

impl AdjacentBound for Wrapping<u64>[src]

impl AdjacentBound for i64[src]

impl AdjacentBound for Wrapping<i64>[src]

impl AdjacentBound for usize[src]

impl AdjacentBound for Wrapping<usize>[src]

impl AdjacentBound for isize[src]

impl AdjacentBound for Wrapping<isize>[src]

impl AdjacentBound for u128[src]

impl AdjacentBound for Wrapping<u128>[src]

impl AdjacentBound for i128[src]

impl AdjacentBound for Wrapping<i128>[src]

Loading content...

Implementors

Loading content...