[−][src]Struct fizyr_rpc::RequestTracker
Tracker that manages open requests.
You normally do not need to work with a request tracker directly. It is used by the different peer structs internally.
Implementations
impl<Body> RequestTracker<Body>
[src]
pub fn new(command_tx: UnboundedSender<Command<Body>>) -> Self
[src]
Create a new request tracker.
The command_tx
channel is used for command messages.
All messages on the channel should be sent to the remote peer by a task with the receiving end of the channel.
pub fn allocate_sent_request(
&mut self,
service_id: i32
) -> Result<SentRequest<Body>, NoFreeRequestIdFound>
[src]
&mut self,
service_id: i32
) -> Result<SentRequest<Body>, NoFreeRequestIdFound>
Allocate a request ID and register a new sent request.
pub fn remove_sent_request(
&mut self,
request_id: u32
) -> Result<(), UnknownRequestId>
[src]
&mut self,
request_id: u32
) -> Result<(), UnknownRequestId>
Remove a sent request from the tracker.
This should be called when a request is finished to make the ID available again.
Note that sent requests are also removed internally when they receive a response,
or when they would receive a message but the SentRequest
was dropped.
pub fn register_received_request(
&mut self,
request_id: u32,
service_id: i32,
body: Body
) -> Result<ReceivedRequest<Body>, DuplicateRequestId>
[src]
&mut self,
request_id: u32,
service_id: i32,
body: Body
) -> Result<ReceivedRequest<Body>, DuplicateRequestId>
Register a new sent request.
Returns an error if the request ID is already in use.
pub fn remove_received_request(
&mut self,
request_id: u32
) -> Result<(), UnknownRequestId>
[src]
&mut self,
request_id: u32
) -> Result<(), UnknownRequestId>
Remove a received request from the tracker.
This should be called when a request is finished to make the ID available again.
Note that received requests are also removed internally when they would receive a message but the ReceivedRequest
was dropped.
pub async fn process_incoming_message<'_>(
&'_ mut self,
message: Message<Body>
) -> Result<Option<Incoming<Body>>, ProcessIncomingMessageError>
[src]
&'_ mut self,
message: Message<Body>
) -> Result<Option<Incoming<Body>>, ProcessIncomingMessageError>
Process an incoming message.
This will pass the message on to an open request if any matches.
Returns an error
- if an incoming request message uses an already claimed request ID
- if an incoming update or response message does not match an open request
Auto Trait Implementations
impl<Body> !RefUnwindSafe for RequestTracker<Body>
impl<Body> Send for RequestTracker<Body> where
Body: Send,
Body: Send,
impl<Body> Sync for RequestTracker<Body> where
Body: Send,
Body: Send,
impl<Body> Unpin for RequestTracker<Body>
impl<Body> !UnwindSafe for RequestTracker<Body>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,