Trait HashSetHandle

Source
pub trait HashSetHandle<K>
where K: Clone + Debug + Eq + Hash + Send + Sync + 'static,
{ // Required methods async fn insert(&self, val: K) -> bool; async fn is_empty(&self) -> bool; }

Required Methods§

Source

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.unwrap();
assert_eq!(res, true);

let handle = actify::Handle::new(std::collections::HashSet::new());
handle.insert(10).await.unwrap();
let res = handle.insert(10).await.unwrap();
assert_eq!(res, false);
Source

async fn is_empty(&self) -> bool

Returns true if the set contains no elements.

§Examples
let handle = Handle::new(HashSet::<i32>::new());
assert!(handle.is_empty().await.unwrap());

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.

Implementors§

Source§

impl<K> HashSetHandle<K> for Handle<HashSet<K>>
where K: Clone + Debug + Eq + Hash + Send + Sync + 'static,