pub trait HashSetHandle<K>{
// Required methods
async fn insert(&self, val: K) -> bool;
async fn is_empty(&self) -> bool;
}Expand description
Extension methods for Handle<HashSet<K>>, exposed as HashSetHandle.
Required Methods§
Sourceasync fn insert(&self, val: K) -> bool
async fn insert(&self, val: K) -> bool
Adds a value to the set. Returns whether the value was newly inserted. That is:
- If the set did not previously contain this value, true is returned.
- If the set already contained this value, false is returned, and the set is not modified: original value is not replaced, and the value passed as argument is dropped.
§Examples
let handle = Handle::new(HashSet::new());
let res = handle.insert(10).await;
assert!(res);
let res = handle.insert(10).await;
assert!(!res);Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.