pub trait RequestableInner: Send + Sync {
// Required methods
fn make_request(&self) -> Result<Request<String>, RequestError>;
fn partial_response_body_ok(&self) -> bool;
fn anonymized(&self) -> AnonymizedRequest;
// Provided methods
fn max_response_len(&self) -> usize { ... }
fn check_circuit<'a>(
&self,
circ: &'a ClientCirc,
) -> Pin<Box<dyn Future<Output = Result<(), RequestError>> + Send + 'a>> { ... }
}
Expand description
Sealed trait to help implement Requestable
: not
visible outside this crate, so we can change its methods however we like.
Required Methods§
Sourcefn make_request(&self) -> Result<Request<String>, RequestError>
fn make_request(&self) -> Result<Request<String>, RequestError>
Build an [http::Request
] from this Requestable, if
it is well-formed.
Sourcefn partial_response_body_ok(&self) -> bool
fn partial_response_body_ok(&self) -> bool
Return true if partial response bodies are potentially useful.
This is true for request types where we’re going to be downloading multiple documents, and we know how to parse out the ones we wanted if the answer is truncated.
Sourcefn anonymized(&self) -> AnonymizedRequest
fn anonymized(&self) -> AnonymizedRequest
Return a value to say whether this request must be anonymized.
Provided Methods§
Sourcefn max_response_len(&self) -> usize
fn max_response_len(&self) -> usize
Return the maximum allowable response length we’ll accept for this request.
Sourcefn check_circuit<'a>(
&self,
circ: &'a ClientCirc,
) -> Pin<Box<dyn Future<Output = Result<(), RequestError>> + Send + 'a>>
fn check_circuit<'a>( &self, circ: &'a ClientCirc, ) -> Pin<Box<dyn Future<Output = Result<(), RequestError>> + Send + 'a>>
Return an error if there is some problem with the provided circuit that would keep it from being used for this request.
Implementors§
impl RequestableInner for AuthCertRequest
impl RequestableInner for ConsensusRequest
impl RequestableInner for HsDescDownloadRequest
Available on crate feature
hs-client
only.impl RequestableInner for HsDescUploadRequest
Available on crate feature
hs-service
only.impl RequestableInner for MicrodescRequest
impl RequestableInner for RouterDescRequest
Available on crate feature
routerdesc
only.impl RequestableInner for RoutersOwnDescRequest
Available on crate feature
routerdesc
only.