pub trait Dispatch<K, P: ?Sized, R>{
// Required methods
fn into_vec(self) -> Vec<(K, Box<dyn DispatchFunction<P, R>>)>;
fn remove<Q>(&mut self, key: &Q)
where K: Borrow<Q>,
Q: Eq + Hash + ?Sized;
fn insert(&mut self, key: K, item: Box<dyn DispatchFunction<P, R>>);
fn contains_key<Q>(&self, key: &Q) -> bool
where K: Borrow<Q>,
Q: Eq + Hash + ?Sized;
fn get<Q>(&self, key: &Q) -> Option<&Box<dyn DispatchFunction<P, R>>>
where K: Borrow<Q>,
Q: Eq + Hash + ?Sized;
fn len(&self) -> usize;
// Provided method
fn call<Q>(&self, key: &Q, params: &P) -> Option<R>
where K: Borrow<Q>,
Q: Eq + Hash + ?Sized { ... }
}Required Methods§
fn into_vec(self) -> Vec<(K, Box<dyn DispatchFunction<P, R>>)>
fn remove<Q>(&mut self, key: &Q)
fn insert(&mut self, key: K, item: Box<dyn DispatchFunction<P, R>>)
fn contains_key<Q>(&self, key: &Q) -> bool
fn get<Q>(&self, key: &Q) -> Option<&Box<dyn DispatchFunction<P, R>>>
fn len(&self) -> usize
Provided Methods§
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.