Struct hashconsing::HConsign

source ·
pub struct HConsign<T: Hash + Eq + Clone, S = RandomState> { /* private fields */ }
Expand description

The consign storing the actual hash consed elements as HConseds.

Implementations§

source§

impl<T: Hash + Eq + Clone> HConsign<T, RandomState>

source

pub fn empty() -> Self

Creates an empty consign.

source

pub fn with_capacity(capacity: usize) -> Self

Creates an empty consign with a capacity.

source§

impl<T: Hash + Eq + Clone, S> HConsign<T, S>

source

pub fn fold<Acc, F>(&self, init: Acc, f: F) -> Accwhere F: FnMut(Acc, HConsed<T>) -> Acc,

Fold on the elements stored in the consign.

source

pub fn fold_res<Acc, F, E>(&self, init: Acc, f: F) -> Result<Acc, E>where F: FnMut(Acc, HConsed<T>) -> Result<Acc, E>,

Fold on the elements stored in the consign, result version.

source

pub fn len(&self) -> usize

The number of elements stored, mostly for testing.

source

pub fn capacity(&self) -> usize

Capacity of the underlying hashtable, mostly for testing.

source

pub fn is_empty(&self) -> bool

True if the consign is empty.

source§

impl<T: Hash + Eq + Clone, S: BuildHasher> HConsign<T, S>

source

pub fn with_hasher(build_hasher: S) -> Self

Creates an empty consign with a custom hash

source

pub fn with_capacity_and_hasher(capacity: usize, build_hasher: S) -> Self

Creates an empty consign with a capacity.

Trait Implementations§

source§

impl<T, S> Display for HConsign<T, S>where T: Hash + Display + Eq + Clone,

source§

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

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

impl<'a, T: Hash + Eq + Clone, S: BuildHasher> HashConsign<T> for &'a mut HConsign<T, S>

source§

fn mk_is_new(self, elm: T) -> (HConsed<T>, bool)

Hashconses something and returns the hash consed version. Read more
source§

fn collect(self)

Removes dead elements from the consign. Read more
source§

fn shrink_to_fit(self)

Shrinks the capacity of the consign as much as possible.
source§

fn collect_to_fit(self)

source§

fn reserve(self, additional: usize)

Reserves capacity for at least additional more elements.
source§

fn mk(self, elm: T) -> HConsed<T>

Creates a HConsed element.

Auto Trait Implementations§

§

impl<T, S> RefUnwindSafe for HConsign<T, S>where S: RefUnwindSafe, T: RefUnwindSafe,

§

impl<T, S> Send for HConsign<T, S>where S: Send, T: Send + Sync,

§

impl<T, S> Sync for HConsign<T, S>where S: Sync, T: Send + Sync,

§

impl<T, S> Unpin for HConsign<T, S>where S: Unpin, T: Unpin,

§

impl<T, S> UnwindSafe for HConsign<T, S>where S: UnwindSafe, T: 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> ToString for Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. 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.