pub struct ApiRouter { /* private fields */ }Expand description
Minimal router for one command endpoint and multiple query endpoints.
Implementations§
Source§impl ApiRouter
impl ApiRouter
Sourcepub fn set_command_endpoint<E: CommandEndpoint + 'static>(
&mut self,
endpoint: E,
)
pub fn set_command_endpoint<E: CommandEndpoint + 'static>( &mut self, endpoint: E, )
Replaces the command endpoint used by this router.
Sourcepub fn register_query<E: QueryEndpoint + 'static>(
&mut self,
endpoint: E,
) -> RuntimeResult<()>
pub fn register_query<E: QueryEndpoint + 'static>( &mut self, endpoint: E, ) -> RuntimeResult<()>
Registers one uniquely named application query endpoint.
Sourcepub fn has_query(&self, name: &QueryName) -> bool
pub fn has_query(&self, name: &QueryName) -> bool
Reports whether a query endpoint is registered.
Sourcepub fn query_names(&self) -> Vec<QueryName>
pub fn query_names(&self) -> Vec<QueryName>
Returns registered query names in deterministic lexical order.
Sourcepub fn dispatch_query(
&self,
name: &QueryName,
request: ApiRequest,
) -> RuntimeResult<ApiResponse>
pub fn dispatch_query( &self, name: &QueryName, request: ApiRequest, ) -> RuntimeResult<ApiResponse>
Dispatches a request to a named query endpoint.
Sourcepub fn dispatch_command(
&self,
request: ApiRequest,
) -> RuntimeResult<ApiResponse>
pub fn dispatch_command( &self, request: ApiRequest, ) -> RuntimeResult<ApiResponse>
Dispatches a request to the configured command endpoint.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for ApiRouter
impl !UnwindSafe for ApiRouter
impl Freeze for ApiRouter
impl Send for ApiRouter
impl Sync for ApiRouter
impl Unpin for ApiRouter
impl UnsafeUnpin for ApiRouter
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
Mutably borrows from an owned value. Read more