Mark ClientRequest and State::AwaitingResponse as must_use
This commit is contained in:
parent
d67de58554
commit
28f3186182
|
@ -25,11 +25,14 @@ pub struct Client {
|
||||||
|
|
||||||
/// A message from the `peer::Client` to the `peer::Server`.
|
/// A message from the `peer::Client` to the `peer::Server`.
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
#[must_use = "tx.send() must be called before drop"]
|
||||||
pub(super) struct ClientRequest {
|
pub(super) struct ClientRequest {
|
||||||
/// The actual request.
|
/// The actual request.
|
||||||
pub request: Request,
|
pub request: Request,
|
||||||
/// The return message channel, included because `peer::Client::call` returns a
|
/// The return message channel, included because `peer::Client::call` returns a
|
||||||
/// future that may be moved around before it resolves.
|
/// future that may be moved around before it resolves.
|
||||||
|
///
|
||||||
|
/// INVARIANT: `tx.send()` must be called before dropping `tx`.
|
||||||
pub tx: oneshot::Sender<Result<Response, SharedPeerError>>,
|
pub tx: oneshot::Sender<Result<Response, SharedPeerError>>,
|
||||||
/// The tracing context for the request, so that work the connection task does
|
/// The tracing context for the request, so that work the connection task does
|
||||||
/// processing messages in the context of this request will have correct context.
|
/// processing messages in the context of this request will have correct context.
|
||||||
|
|
|
@ -304,6 +304,7 @@ impl Handler {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[must_use = "AwaitingResponse.tx.send() must be called before drop"]
|
||||||
pub(super) enum State {
|
pub(super) enum State {
|
||||||
/// Awaiting a client request or a peer message.
|
/// Awaiting a client request or a peer message.
|
||||||
AwaitingRequest,
|
AwaitingRequest,
|
||||||
|
|
Loading…
Reference in New Issue