pub struct DispatchTable {
map: HashMap<FuncType, InvokerEnt>,
}
Expand description
A collection of method implementations for different method and object types.
A DispatchTable is constructed at run-time from entries registered with
static_rpc_invoke_fn!
.
There is one for each arti-rpcserver::RpcMgr
, shared with each arti-rpcserver::Connection
.
Fields§
§map: HashMap<FuncType, InvokerEnt>
An internal HashMap used to look up the correct function for a given method/object pair.
Implementations§
Source§impl DispatchTable
impl DispatchTable
Sourcepub fn dispatch_information(&self) -> RpcDispatchInformation
Available on crate feature describe-methods
only.
pub fn dispatch_information(&self) -> RpcDispatchInformation
describe-methods
only.Return a description for all of the RPC methods available, which types they expect and return, and which objects they apply to.
Currently, the resulting object is good for nothing but serialization.
Source§impl DispatchTable
impl DispatchTable
Sourcepub fn from_inventory() -> Self
pub fn from_inventory() -> Self
Construct a DispatchTable
from the entries registered statically via
static_rpc_invoke_fn!
.
§Panics
Panics if two entries are found for the same (method,object) types.
Sourcefn insert_inner(&mut self, ent: InvokerEnt) -> Option<InvokerEnt>
fn insert_inner(&mut self, ent: InvokerEnt) -> Option<InvokerEnt>
Add a new entry to this DispatchTable, and return the old value if any.
Sourcepub fn insert(&mut self, ent: InvokerEnt)
pub fn insert(&mut self, ent: InvokerEnt)
Add a new entry to this DispatchTable.
§Panics
Panics if there was a previous entry inserted with the same (Object,Method) pair, but (apparently) with a different implementation function, or from a macro invocation.
Sourcepub fn extend<I>(&mut self, ents: I)where
I: IntoIterator<Item = InvokerEnt>,
pub fn extend<I>(&mut self, ents: I)where
I: IntoIterator<Item = InvokerEnt>,
Sourcefn resolve_entry(
&self,
obj: Arc<dyn Object>,
method_id: TypeId,
) -> Result<(Arc<dyn Object>, &InvokerEnt), InvokeError>
fn resolve_entry( &self, obj: Arc<dyn Object>, method_id: TypeId, ) -> Result<(Arc<dyn Object>, &InvokerEnt), InvokeError>
Helper: Look up the InvokerEnt
for a given method on a given object,
performing delegation as necessary.
Along with the InvokerEnt
, return either the object, or a delegation target
on which the method should be invoked.
Sourcepub(crate) fn resolve_rpc_invoker(
&self,
obj: Arc<dyn Object>,
method: &dyn DynMethod,
) -> Result<(Arc<dyn Object>, &'static dyn RpcInvocable), InvokeError>
pub(crate) fn resolve_rpc_invoker( &self, obj: Arc<dyn Object>, method: &dyn DynMethod, ) -> Result<(Arc<dyn Object>, &'static dyn RpcInvocable), InvokeError>
Helper: Resolve the invoker for a given RPC object and a given method type, if there is one.
Along with the invoker, return either the object, or a delegation target on which the method should be invoked.
Sourcepub(crate) fn resolve_special_invoker<M: Method>(
&self,
obj: Arc<dyn Object>,
) -> Result<(Arc<dyn Object>, &'static dyn Invocable), InvokeError>
pub(crate) fn resolve_special_invoker<M: Method>( &self, obj: Arc<dyn Object>, ) -> Result<(Arc<dyn Object>, &'static dyn Invocable), InvokeError>
Helper: Return the special invoker for a given object and a given method type, if there is one.
Along with the invoker, return either the object, or a delegation target on which the method should be invoked.
Trait Implementations§
Source§impl Clone for DispatchTable
impl Clone for DispatchTable
Source§fn clone(&self) -> DispatchTable
fn clone(&self) -> DispatchTable
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreAuto Trait Implementations§
impl Freeze for DispatchTable
impl !RefUnwindSafe for DispatchTable
impl Send for DispatchTable
impl Sync for DispatchTable
impl Unpin for DispatchTable
impl !UnwindSafe for DispatchTable
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
, which can then be
downcast
into Box<dyn ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
, which can then be further
downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.