core::collections::set
이 페이지의 내용
API 참조는 영어로만 있습니다. 표준 라이브러리 소스의 영어 문서 주석에서 만듭니다.
Set<T, S>, a hash set
over Dict<T, bool, S>, so it iterates in insertion order.
Structs
SetSource
pub struct Set<T, S = RandomState>S builds the hashers (RandomState: the process key).
The set as a
FrozenSet, which threads share without a lock or a copy. O(1): the frozen set takes the members over, and usingselfafter is a compile error (to_set()gives a set to change again; freeze aclone()to keep this one).An empty set.
An empty set hashing with
state's hashers.Room for
capmembers, hashing withstate's hashers.What builds the set's hashers.
The number of members.
truewhen the set has no member.truewhenxwas not there yet.truewhenxwas there.truewhenxis a member.Drop every member.
Keep only the members
keepaccepts, in place; O(n).
Sourcepub const fn extend<I: IntoIterator<Item = T>>(§self, items: I) Insert every item of
items.The members of either set: those of
selfin its order, then those only inotherin its order.The members of both sets, in
self's order.The members of
selfnot inother, inself's order.The members of exactly one set: those only in
selfin its order, then those only inotherin its order.truewhen every member ofselfis inother.truewhen every member ofotheris inself.truewhen no member is in both sets.Remove and return the member inserted last, or
nonewhen the set is empty. Python:s.pop()(which takes any member).nabilet s = {1, 2, 3}; assert((s.pop() ?? 0) == 3 && s.len() == 2); assert(s.drain() == [1, 2] && s.is_empty());Remove every member and return them, in insertion order.
The members in a new list, in iteration order.
The members, lazily (insertion order).
Trait implementations 11
impl<T, S> !Sync for Set<T, S>impl<T: Hash, S: BuildHasher + Default> Default for Set<T, S>impl<T: Hash + Clone, S: BuildHasher> Clone for Set<T, S>impl<T: Hash, S: BuildHasher> IntoIterator for Set<T, S>impl<T: Hash, S: BuildHasher + Default> FromIterator<T> for Set<T, S>impl<T: Hash, S: BuildHasher + Default> From<List<T>> for Set<T, S>impl<T: Hash, S: BuildHasher> AddAssign<T> for Set<T, S>impl<T: Hash, S: BuildHasher> PartialEq for Set<T, S>impl<T: Hash, S: BuildHasher> Eq for Set<T, S>impl<T: Hash, S: BuildHasher> Hash for Set<T, S>impl<T: Hash + Debug, S: BuildHasher> Debug for Set<T, S>
SetIterSource
pub struct SetIter<T, S = RandomState>The members of a set, in insertion order.
Trait implementations 2
impl<T, S> Debug for SetIter<T, S>impl<T: Hash, S: BuildHasher> Iterator for SetIter<T, S>