pub struct Endpoint<M, H>where
M: Message,
H: StreamingEndpointHandler<M>,{ /* private fields */ }
Expand description
This struct represents an endpoint for message of type M
.
Creating a new endpoint is done by calling NetApp::endpoint
.
An endpoint is identified primarily by its path, which is specified
at creation time.
An Endpoint
is used both to send requests to remote nodes,
and to specify the handler for such requests on the local node.
The type H
represents the type of the handler object for
endpoint messages (see StreamingEndpointHandler
).
Implementations§
source§impl<M, H> Endpoint<M, H>where
M: Message,
H: StreamingEndpointHandler<M>,
impl<M, H> Endpoint<M, H>where M: Message, H: StreamingEndpointHandler<M>,
sourcepub fn set_handler(&self, h: Arc<H>)
pub fn set_handler(&self, h: Arc<H>)
Set the object that is responsible of handling requests to this endpoint on the local node.
sourcepub async fn call_streaming<T>(
&self,
target: &NodeID,
req: T,
prio: RequestPriority
) -> Result<Resp<M>, Error>where
T: IntoReq<M>,
pub async fn call_streaming<T>( &self, target: &NodeID, req: T, prio: RequestPriority ) -> Result<Resp<M>, Error>where T: IntoReq<M>,
Call this endpoint on a remote node (or on the local node, for that matter). This function invokes the full version that allows to attach a stream to the request and to receive such a stream attached to the response.
sourcepub async fn call(
&self,
target: &NodeID,
req: M,
prio: RequestPriority
) -> Result<<M as Message>::Response, Error>
pub async fn call( &self, target: &NodeID, req: M, prio: RequestPriority ) -> Result<<M as Message>::Response, Error>
Call this endpoint on a remote node. This function is the simplified
version that doesn’t allow to have streams attached to the request
or the response; see call_streaming
for the full version.