Struct canrun::collections::lmap::LMap

source ·
pub struct LMap<K: Unify + Eq + Hash + Debug, V: Unify + Debug> { /* private fields */ }
Expand description

A HashMap-like data structure with LVar keys and values.

Implementations§

source§

impl<K: Unify + Eq + Hash + Debug, V: Unify + Debug> LMap<K, V>

source

pub fn new() -> Self

Create a new LMap value.

You may also be interested in the lmap! macro.

Example:
use canrun::lmap::LMap;

let map: LMap<i32, i32> = LMap::new();
source

pub fn insert<Ki, Vi>(&mut self, key: Ki, value: Vi)where Ki: Into<Value<K>>, Vi: Into<Value<V>>,

Add a key/value pair to an existing LMap.

Example:
use canrun::lmap::LMap;

let mut map: LMap<i32, i32> = LMap::new();
map.insert(1, 2);

Trait Implementations§

source§

impl<K: Clone + Unify + Eq + Hash + Debug, V: Clone + Unify + Debug> Clone for LMap<K, V>

source§

fn clone(&self) -> LMap<K, V>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<K: Debug + Unify + Eq + Hash + Debug, V: Debug + Unify + Debug> Debug for LMap<K, V>

source§

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

Formats the value using the given formatter. Read more
source§

impl<K: Default + Unify + Eq + Hash + Debug, V: Default + Unify + Debug> Default for LMap<K, V>

source§

fn default() -> LMap<K, V>

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

impl<Kv, Kr, Vv, Vr> Reify for LMap<Kv, Vv>where Kv: Unify + Eq + Hash + Reify<Reified = Kr>, Kr: Eq + Hash, Vv: Unify + Reify<Reified = Vr>,

§

type Reified = HashMap<Kr, Vr, RandomState>

The “concrete” type that Self reifies to.
source§

fn reify_in(&self, state: &ReadyState) -> Option<Self::Reified>

Extract a reified Self from a compatible State. This trait is usually used indirectly through the Query trait. Read more
source§

impl<K: Unify + Eq + Hash + Debug, V: Unify + Debug> Unify for LMap<K, V>

source§

fn unify(state: State, a: Rc<Self>, b: Rc<Self>) -> Option<State>

Attempt to unify two fully resolved values. Read more

Auto Trait Implementations§

§

impl<K, V> RefUnwindSafe for LMap<K, V>where K: RefUnwindSafe, V: RefUnwindSafe,

§

impl<K, V> !Send for LMap<K, V>

§

impl<K, V> !Sync for LMap<K, V>

§

impl<K, V> Unpin for LMap<K, V>where K: Unpin, V: Unpin,

§

impl<K, V> UnwindSafe for LMap<K, V>where K: UnwindSafe + RefUnwindSafe, V: UnwindSafe + RefUnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

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

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

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

Performs the conversion.