pub trait BlockingResponse:
MaybeRead
+ Send
+ Sync
+ 'static {
// Required methods
fn status(&self) -> u16;
fn content_length(&self) -> Option<u64>;
fn get_header(&self, header: &str) -> Result<Vec<String>>;
fn text(&mut self) -> Result<String>;
fn bytes(&mut self) -> Result<Vec<u8>>;
// Provided method
fn describe(&self, f: &mut Formatter<'_>) -> Result { ... }
}blocking only.Expand description
Trait for blocking HTTP responses.
This trait provides methods for accessing the data in an HTTP response and extends io::Read to allow streaming the response body.
§Response Method Receivers
Note that the BlockingResponse trait uses &mut self receivers for content reading methods
(text(), bytes(), etc.) to ensure object safety and dyn compatibility.
This differs from the main nyquest crate which uses consuming self receivers.
Backend implementors should design their implementations with the understanding that these methods may be called only once per response instance, even though the signature allows multiple calls. The nyquest facade enforces this by consuming the response.
Required Methods§
Sourcefn content_length(&self) -> Option<u64>
fn content_length(&self) -> Option<u64>
Returns the content-length of the response body, if known.
Provided Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".