SBTreeSet

Struct SBTreeSet 

Source
pub struct SBTreeSet<T: StableType + AsFixedSizeBytes + Ord> { /* private fields */ }
Expand description

B-plus tree based set data structure

This is just a wrapper around SBTreeMap<T, ()>, read its documentation for more info on the internals

Implementations§

Source§

impl<T: Ord + StableType + AsFixedSizeBytes> SBTreeSet<T>

Source

pub fn new() -> Self

Source

pub fn len(&self) -> u64

Source

pub fn is_empty(&self) -> bool

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: Ord + ?Sized,

Source

pub fn clear(&mut self)

Source

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

Source

pub fn get_random(&self, seed: u32) -> Option<SRef<'_, T>>

Source

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

Trait Implementations§

Source§

impl<T: StableType + AsFixedSizeBytes + Ord> AsFixedSizeBytes for SBTreeSet<T>

Source§

const SIZE: usize = 16usize

Size of self when encoded
Source§

type Buf = <SBTreeMap<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 + Ord + Debug> Debug for SBTreeSet<T>

Source§

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

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

impl<T: Ord + StableType + AsFixedSizeBytes> Default for SBTreeSet<T>

Source§

fn default() -> Self

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

impl<T: StableType + AsFixedSizeBytes + Ord> StableType for SBTreeSet<T>

Source§

unsafe fn stable_drop_flag_on(&mut self)

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

unsafe fn stable_drop_flag_off(&mut self)

Sets stable drop flag to off 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 SBTreeSet<T>

§

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

§

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

§

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

§

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

§

impl<T> UnwindSafe for SBTreeSet<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.