pub struct Endpoint { /* private fields */ }
Expand description
A JSON-RPC endpoint that can send requests (Client role), and send responses to requests (Server role).
This type has (mostly) handle semantics: it can be copied freely, used in multiple threads.
However, someone must be responsible for requesting an explicit shutdown of the Endpoint. If this is not done, the OutputAgent will panic once the last reference is dropped.
Implementations§
Source§impl Endpoint
impl Endpoint
pub fn start_with(output_agent: OutputAgent) -> Endpoint
pub fn is_shutdown(&self) -> bool
pub fn request_shutdown(&self)
pub fn shutdown_and_join(&self)
pub fn next_id(&self) -> Id
Source§impl Endpoint
impl Endpoint
Sourcepub fn send_request<PARAMS: Serialize, RET: Deserialize, RET_ERROR: Deserialize>(
&mut self,
method_name: &str,
params: PARAMS,
) -> GResult<RequestFuture<RET, RET_ERROR>>
pub fn send_request<PARAMS: Serialize, RET: Deserialize, RET_ERROR: Deserialize>( &mut self, method_name: &str, params: PARAMS, ) -> GResult<RequestFuture<RET, RET_ERROR>>
Send a (non-notification) request
Sourcepub fn send_notification<PARAMS: Serialize>(
&self,
method_name: &str,
params: PARAMS,
) -> GResult<()>
pub fn send_notification<PARAMS: Serialize>( &self, method_name: &str, params: PARAMS, ) -> GResult<()>
Send a notification
pub fn write_request<PARAMS: Serialize>( &self, id: Option<Id>, method_name: &str, params: PARAMS, ) -> GResult<()>
Sourcepub fn handle_incoming_response(&mut self, response: Response)
pub fn handle_incoming_response(&mut self, response: Response)
Handle a well-formed incoming JsonRpc request object
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Endpoint
impl RefUnwindSafe for Endpoint
impl Send for Endpoint
impl Sync for Endpoint
impl Unpin for Endpoint
impl UnwindSafe for Endpoint
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