Struct arith::ArithMap[][src]

pub struct ArithMap<'a, V> {
    pub hashmap: HashMap<&'a str, V>,
}

Fields

hashmap: HashMap<&'a str, V>

Implementations

impl<V> ArithMap<'_, V> where
    V: Copy + Default + PartialEq
[src]

pub fn prune(&mut self)[src]

let mut x = arithmap!{"a" => 0, "b" => 1};
let y = arithmap!{"b" => 1};
x.prune();

assert_eq!(x, y);

Trait Implementations

impl<V> Add<ArithMap<'_, V>> for ArithMap<'_, V> where
    V: Add<Output = V> + AddAssign + Copy + Default
[src]

let x = arithmap!{"a" => 1, "b" => 2};
let y = arithmap!{"b" => 2, "c" => 3};
let z = arithmap!{"a" => 1, "b" => 4, "c" => 3};

assert_eq!(x + y, z);

type Output = Self

The resulting type after applying the + operator.

fn add(self, other: Self) -> Self[src]

Performs the + operation. Read more

impl<V> Add<V> for ArithMap<'_, V> where
    V: AddAssign + Copy
[src]

let x = arithmap!{"a" => 1, "b" => 2};
let y = arithmap!{"a" => 2, "b" => 3};

assert_eq!(x + 1, y);

type Output = Self

The resulting type after applying the + operator.

fn add(self, other: V) -> Self[src]

Performs the + operation. Read more

impl<V> AddAssign<ArithMap<'_, V>> for ArithMap<'_, V> where
    V: Add<Output = V> + AddAssign + Copy + Default
[src]

let mut x = arithmap!{"a" => 1, "b" => 2};
let y = arithmap!{"b" => 2, "c" => 3};
x += y;
let z = arithmap!{"a" => 1, "b" => 4, "c" => 3};

assert_eq!(x, z);

fn add_assign(&mut self, other: Self)[src]

Performs the += operation. Read more

impl<V> AddAssign<V> for ArithMap<'_, V> where
    V: AddAssign + Copy
[src]

let mut x = arithmap!{"a" => 1, "b" => 2};
x += 1;
let y = arithmap!{"a" => 2, "b" => 3};

assert_eq!(x, y);

fn add_assign(&mut self, other: V)[src]

Performs the += operation. Read more

impl<V> Debug for ArithMap<'_, V> where
    V: Debug
[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

impl<'a, V: Default> Default for ArithMap<'a, V>[src]

fn default() -> ArithMap<'a, V>[src]

Returns the “default value” for a type. Read more

impl<V> Mul<V> for ArithMap<'_, V> where
    V: MulAssign + Copy
[src]

let x = arithmap!{"a" => 1.0, "b" => 2.0};
let y = arithmap!{"a" => 2.0, "b" => 4.0};

assert_eq!(x * 2.0, y);

type Output = Self

The resulting type after applying the * operator.

fn mul(self, other: V) -> Self[src]

Performs the * operation. Read more

impl<V> MulAssign<V> for ArithMap<'_, V> where
    V: MulAssign + Copy
[src]

let mut x = arithmap!{"a" => 1, "b" => 2};
x *= 2;
let y = arithmap!{"a" => 2, "b" => 4};

assert_eq!(x, y);

fn mul_assign(&mut self, other: V)[src]

Performs the *= operation. Read more

impl<'a, V: PartialEq> PartialEq<ArithMap<'a, V>> for ArithMap<'a, V>[src]

fn eq(&self, other: &ArithMap<'a, V>) -> bool[src]

This method tests for self and other values to be equal, and is used by ==. Read more

fn ne(&self, other: &ArithMap<'a, V>) -> bool[src]

This method tests for !=.

impl<V> Sub<ArithMap<'_, V>> for ArithMap<'_, V> where
    V: Sub<Output = V> + SubAssign + Copy + Default
[src]

let x = arithmap!{"a" => 1, "b" => 2};
let y = arithmap!{"b" => 2, "c" => 3};
let z = arithmap!{"a" => 1, "b" => 0, "c" => -3};

assert_eq!(x - y, z);

type Output = Self

The resulting type after applying the - operator.

fn sub(self, other: Self) -> Self[src]

Performs the - operation. Read more

impl<V> Sub<V> for ArithMap<'_, V> where
    V: SubAssign + Copy
[src]

let x = arithmap!{"a" => 1, "b" => 2};
let y = arithmap!{"a" => 0, "b" => 1};

assert_eq!(x - 1, y);

type Output = Self

The resulting type after applying the - operator.

fn sub(self, other: V) -> Self[src]

Performs the - operation. Read more

impl<V> SubAssign<ArithMap<'_, V>> for ArithMap<'_, V> where
    V: Sub<Output = V> + SubAssign + Copy + Default
[src]

let mut x = arithmap!{"a" => 1, "b" => 2};
let y = arithmap!{"b" => 2, "c" => 3};
x -= y;
let z = arithmap!{"a" => 1, "b" => 0, "c" => -3};

assert_eq!(x, z);

fn sub_assign(&mut self, other: Self)[src]

Performs the -= operation. Read more

impl<V> SubAssign<V> for ArithMap<'_, V> where
    V: SubAssign + Copy
[src]

let mut x = arithmap!{"a" => 1, "b" => 2};
x -= 1;
let y = arithmap!{"a" => 0, "b" => 1};

assert_eq!(x, y);

fn sub_assign(&mut self, other: V)[src]

Performs the -= operation. Read more

impl<'a, V: Eq> Eq for ArithMap<'a, V>[src]

impl<'a, V> StructuralEq for ArithMap<'a, V>[src]

impl<'a, V> StructuralPartialEq for ArithMap<'a, V>[src]

Auto Trait Implementations

impl<'a, V> RefUnwindSafe for ArithMap<'a, V> where
    V: RefUnwindSafe

impl<'a, V> Send for ArithMap<'a, V> where
    V: Send

impl<'a, V> Sync for ArithMap<'a, V> where
    V: Sync

impl<'a, V> Unpin for ArithMap<'a, V> where
    V: Unpin

impl<'a, V> UnwindSafe for ArithMap<'a, V> where
    V: UnwindSafe

Blanket Implementations

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

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

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

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

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

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

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

pub fn from(t: T) -> T[src]

Performs the conversion.

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

pub fn into(self) -> U[src]

Performs the conversion.

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.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

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.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.