pub struct Set { /* private fields */ }Expand description
A Python set.
A dict with nothing in the values, which is what CPython’s set was before it got a structure of its own. The saving from splitting them is one word an element, and it is worth taking once the semantics have stopped moving.
Implementations§
Source§impl Set
impl Set
Sourcepub fn insert(&mut self, value: Key) -> bool
pub fn insert(&mut self, value: Key) -> bool
Puts a value in, and says whether it was not already there.
Sourcepub fn remove(&mut self, value: &Key) -> bool
pub fn remove(&mut self, value: &Key) -> bool
Takes a value out, and says whether it was there.
Sourcepub fn iter(&self) -> impl Iterator<Item = &Key>
pub fn iter(&self) -> impl Iterator<Item = &Key>
The members.
In insertion order, which is not something a set promises and not something CPython gives, so nothing may lean on it.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Set
impl !Send for Set
impl !Sync for Set
impl !UnwindSafe for Set
impl Freeze for Set
impl Unpin for Set
impl UnsafeUnpin for Set
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