Struct tor_dirclient::DirResponse
source · pub struct DirResponse { /* private fields */ }
Expand description
A successful (or at any rate, well-formed) response to a directory request.
Implementations§
source§impl DirResponse
impl DirResponse
sourcepub fn from_body(body: impl AsRef<[u8]>) -> Self
pub fn from_body(body: impl AsRef<[u8]>) -> Self
Construct a new successful DirResponse from its body.
sourcepub fn status_code(&self) -> u16
pub fn status_code(&self) -> u16
Return the HTTP status code for this response.
sourcepub fn is_partial(&self) -> bool
pub fn is_partial(&self) -> bool
Return true if this is in incomplete response.
sourcepub fn error(&self) -> Option<&RequestError>
pub fn error(&self) -> Option<&RequestError>
Return the error from this response, if any.
sourcepub fn output_unchecked(&self) -> &[u8] ⓘ
pub fn output_unchecked(&self) -> &[u8] ⓘ
Return the output from this response.
Returns some output, even if the response indicates truncation or an error.
sourcepub fn output(&self) -> Result<&[u8], RequestFailedError>
pub fn output(&self) -> Result<&[u8], RequestFailedError>
Return the output from this response, if it was successful and complete.
sourcepub fn output_string(&self) -> Result<&str, RequestFailedError>
pub fn output_string(&self) -> Result<&str, RequestFailedError>
Return this the output from this response, as a string, if it was successful and complete and valid UTF-8.
sourcepub fn into_output_unchecked(self) -> Vec<u8> ⓘ
pub fn into_output_unchecked(self) -> Vec<u8> ⓘ
Consume this DirResponse and return the output in it.
Returns some output, even if the response indicates truncation or an error.
sourcepub fn into_output(self) -> Result<Vec<u8>, RequestFailedError>
pub fn into_output(self) -> Result<Vec<u8>, RequestFailedError>
Consume this DirResponse and return the output, if it was successful and complete.
sourcepub fn into_output_string(self) -> Result<String, RequestFailedError>
pub fn into_output_string(self) -> Result<String, RequestFailedError>
Consume this DirResponse and return the output, as a string, if it was successful and complete and valid UTF-8.
sourcepub fn source(&self) -> Option<&SourceInfo>
pub fn source(&self) -> Option<&SourceInfo>
Return the source information about this response.
Trait Implementations§
source§impl Clone for DirResponse
impl Clone for DirResponse
source§fn clone(&self) -> DirResponse
fn clone(&self) -> DirResponse
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for DirResponse
impl Send for DirResponse
impl Sync for DirResponse
impl Unpin for DirResponse
impl !UnwindSafe for DirResponse
Blanket Implementations§
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
. Read more§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
. Read more§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s. Read more§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s. Read more