pub struct Set { /* private fields */ }Expand description
A set: distinct values, sorted.
Its members lie in a balanced tree in ascending order, so looking one up, inserting or removing one costs O(log n), and a set made from a stored one shares every node the change does not touch.
Implementations§
Source§impl Set
impl Set
Sourcepub fn from_items(
items: impl IntoIterator<Item = Value>,
) -> Result<Set, DataError>
pub fn from_items( items: impl IntoIterator<Item = Value>, ) -> Result<Set, DataError>
Sourcepub fn iter(&self) -> impl ExactSizeIterator<Item = &Value>
pub fn iter(&self) -> impl ExactSizeIterator<Item = &Value>
Returns the elements, in order.
Sourcepub fn root(&self) -> Option<&Node<Member>>
pub fn root(&self) -> Option<&Node<Member>>
Returns the tree the members lie in, in ascending order, or None
when there are none.
Sourcepub fn from_tree(root: Option<Node<Member>>) -> Set
pub fn from_tree(root: Option<Node<Member>>) -> Set
Returns the set whose members are those of root, sharing it.
The members must ascend across the whole tree and be distinct, as
those of Set::root do; the caller checks that, as reading history
does, and a debug build checks it again.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Set
impl !UnwindSafe for Set
impl Forget for Set
impl Freeze for Set
impl Move for Set
impl Send for Set
impl Sync for Set
impl Unpin for Set
impl UnsafeUnpin for Setwhere
*const ArcInner<Inner<Member>> is !null: UnsafeUnpin,
PhantomData<ArcInner<Inner<Member>>>: UnsafeUnpin,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more