Skip to main content

DenseHashSet

Struct DenseHashSet 

Source
pub struct DenseHashSet<K, H = DenseHashDefault<K>, E = DenseEqDefault<K>> { /* private fields */ }

Implementations§

Source§

impl<K, H, E> DenseHashSet<K, H, E>
where K: Clone, H: DenseHasher<K> + Default, E: DenseEq<K> + Default,

Source

pub fn new(empty_key: K) -> Self

DenseHashSet(empty_key, buckets = 0). Reference: DenseHash.h:482-485.

Source

pub fn insert(&mut self, key: K) -> &K

insert — inserts key if absent and returns a reference to the stored key. Reference: DenseHash.h:492-496.

Source

pub fn find(&self, key: &K) -> Option<&K>

const Key* find(const Key&) const. Reference: DenseHash.h:498-501.

Source

pub fn get(&self, key: &K) -> Option<&K>

std-style alias for generated Rust that spelled C++ find as get.

Source

pub fn insert_mut(&mut self, key: K) -> &mut K

Mutable analogue of insert: inserts key if absent and returns a mutable reference to the stored key. C++ insert returns const Key& and callers reach for const_cast<Key&> when they need to fix up a stored entry in place (e.g. AstNameTable::getOrAddWithType rewriting a non-owned name pointer to an allocator-owned copy of the same bytes — the hash/eq are unchanged so the slot stays valid). This exposes that mutation soundly. Not a separate C++ method; the mutable access is the faithful Rust spelling of the const_cast idiom.

Source

pub fn find_mut(&mut self, key: &K) -> Option<&mut K>

Mutable analogue of find.

Source

pub fn contains(&self, key: &K) -> bool

contains. Reference: DenseHash.h:503-506.

Source

pub fn size(&self) -> usize

size. Reference: DenseHash.h:508-511.

Source

pub fn empty(&self) -> bool

empty. Reference: DenseHash.h:513-516.

Source

pub fn clear(&mut self)

clear. Reference: DenseHash.h:487-490.

Source

pub fn iter(&self) -> ConstIterator<'_, K, K, ItemInterfaceSet<K>, H, E>

begin()/end() iteration, yielding &Key.

Trait Implementations§

Source§

impl<K: Clone, H: Clone, E: Clone> Clone for DenseHashSet<K, H, E>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<K: Debug, H, E> Debug for DenseHashSet<K, H, E>

Source§

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

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

impl<K, H, E> Default for DenseHashSet<K, H, E>
where K: Clone + DenseDefault, H: DenseHasher<K> + Default, E: DenseEq<K> + Default,

C++ members declare their empty key inline (DenseHashSet<T> x{emptyT}); Rust #[derive(Default)] on containing structs needs this. The empty key comes from the element’s DenseDefault sentinel.

Source§

fn default() -> Self

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

impl<K, H, E> PartialEq for DenseHashSet<K, H, E>
where K: Clone, H: DenseHasher<K> + Default, E: DenseEq<K> + Default,

operator== / operator!= — set equality. Reference: DenseHash.h:538-555.

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

Auto Trait Implementations§

§

impl<K, H, E> Freeze for DenseHashSet<K, H, E>
where K: Freeze, H: Freeze, E: Freeze,

§

impl<K, H, E> RefUnwindSafe for DenseHashSet<K, H, E>

§

impl<K, H, E> Send for DenseHashSet<K, H, E>
where K: Send, H: Send, E: Send,

§

impl<K, H, E> Sync for DenseHashSet<K, H, E>
where K: Sync, H: Sync, E: Sync,

§

impl<K, H, E> Unpin for DenseHashSet<K, H, E>
where K: Unpin, H: Unpin, E: Unpin,

§

impl<K, H, E> UnsafeUnpin for DenseHashSet<K, H, E>

§

impl<K, H, E> UnwindSafe for DenseHashSet<K, H, E>
where K: UnwindSafe, H: UnwindSafe, E: UnwindSafe,

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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 T
where 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> ToOwned for T
where T: Clone,

Source§

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 T
where U: Into<T>,

Source§

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 T
where U: TryFrom<T>,

Source§

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.