SHashSet

Struct SHashSet 

Source
pub struct SHashSet<T: StableType + AsFixedSizeBytes + Hash + Eq> { /* private fields */ }
Expand description

Hashmap-based hashset

This is just a wrapper around SHashMap<T, ()>, read it’s documentation to get info on the internals.

Implementations§

Source§

impl<T: StableType + AsFixedSizeBytes + Hash + Eq> SHashSet<T>

Source

pub fn new() -> Self

Source

pub fn new_with_capacity(capacity: usize) -> Result<Self, OutOfMemory>

Source

pub fn insert(&mut self, value: T) -> Result<bool, T>

Source

pub fn remove<Q>(&mut self, value: &Q) -> bool
where T: Borrow<Q>, Q: Hash + Eq + ?Sized,

Source

pub fn contains<Q>(&self, value: &Q) -> bool
where T: Borrow<Q>, Q: Hash + Eq + ?Sized,

Source

pub fn len(&self) -> usize

Source

pub fn capacity(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Source

pub fn is_full(&self) -> bool

Source

pub fn iter(&self) -> SHashSetIter<'_, T>

Source

pub fn clear(&mut self)

Trait Implementations§

Source§

impl<T: StableType + AsFixedSizeBytes + Hash + Eq> AsFixedSizeBytes for SHashSet<T>

Source§

const SIZE: usize = 24usize

Size of self when encoded
Source§

type Buf = <SHashMap<T, ()> as AsFixedSizeBytes>::Buf

Buffer that is used to encode this value into
Source§

fn as_fixed_size_bytes(&self, buf: &mut [u8])

Encodes itself into a slice of bytes. Read more
Source§

fn from_fixed_size_bytes(arr: &[u8]) -> Self

Decodes itself from a slice of bytes. Read more
Source§

fn as_new_fixed_size_bytes(&self) -> Self::Buf

Encodes itself into a new Self::Buf of size == Self::SIZE
Source§

impl<T: StableType + AsFixedSizeBytes + Hash + Eq + Debug> Debug for SHashSet<T>

Source§

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

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

impl<T: StableType + AsFixedSizeBytes + Hash + Eq> Default for SHashSet<T>

Source§

fn default() -> Self

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

impl<T: StableType + AsFixedSizeBytes + Hash + Eq> StableType for SHashSet<T>

Source§

unsafe fn stable_drop_flag_off(&mut self)

Sets stable drop flag to off position, if it is applicable Read more
Source§

unsafe fn stable_drop_flag_on(&mut self)

Should set stable drop flag to on position, if it is applicable Read more
Source§

fn should_stable_drop(&self) -> bool

Should return the value of the stable drop flag
Source§

unsafe fn stable_drop(&mut self)

Performs stable drop, releasing all underlying stable memory of this data structure Read more

Auto Trait Implementations§

§

impl<T> Freeze for SHashSet<T>

§

impl<T> RefUnwindSafe for SHashSet<T>
where T: RefUnwindSafe,

§

impl<T> Send for SHashSet<T>
where T: Send,

§

impl<T> Sync for SHashSet<T>
where T: Sync,

§

impl<T> Unpin for SHashSet<T>
where T: Unpin,

§

impl<T> UnwindSafe for SHashSet<T>
where T: 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> AsDynSizeBytes for T

Source§

fn as_dyn_size_bytes(&self) -> Vec<u8>

Encodes self into vector of bytes Read more
Source§

fn from_dyn_size_bytes(buf: &[u8]) -> T

Decodes self from a slice of bytes. 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> 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> Same for T

Source§

type Output = T

Should always be Self
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.