[][src]Struct brokaw::raw::RawResponse

pub struct RawResponse { /* fields omitted */ }

A response returned by the low-level NntpConnection

  1. The contents are guaranteed to be represent a syntactically valid NNTP response
  2. The contents ARE NOT guaranteed to be UTF-8 as the NNTP does not require contents be UTF-8.

Implementations

impl RawResponse[src]

pub fn code(&self) -> ResponseCode[src]

The response code

pub fn has_data_blocks(&self) -> bool[src]

Return true if this response is a multi-line response and contains a data block section

pub fn data_blocks(&self) -> Option<&DataBlocks>[src]

Return multi-line data blocks

pub fn first_line(&self) -> &[u8][src]

Return the first line of the response

pub fn first_line_without_code(&self) -> &[u8][src]

Return the first line of the response without the response code

pub fn fail_unless(
    self,
    desired: impl Into<ResponseCode>
) -> Result<RawResponse, Error>
[src]

Converts a response into an error if it does not match the provided status

pub fn first_line_to_utf8_lossy(&self) -> Cow<str>[src]

Lossily convert the first line to UTF-8

pub unsafe fn first_line_as_utf8_unchecked(&self) -> &str[src]

Convert the initial response payload into UTF-8 without checking

Safety

This function is unsafe because NNTP responses are NOT required to be UTF-8. This call simply calls from_utf8_unchecked under the hood.

Trait Implementations

impl Clone for RawResponse[src]

impl Debug for RawResponse[src]

impl<'_> TryFrom<&'_ RawResponse> for Body[src]

type Error = Error

The type returned in the event of a conversion error.

impl<'_> TryFrom<&'_ RawResponse> for BinaryArticle[src]

type Error = Error

The type returned in the event of a conversion error.

fn try_from(resp: &RawResponse) -> Result<Self>[src]

Convert a raw response into an article

For the specification see RFC 3977 sections:

impl<'_> TryFrom<&'_ RawResponse> for Head[src]

type Error = Error

The type returned in the event of a conversion error.

impl<'_> TryFrom<&'_ RawResponse> for Stat[src]

type Error = Error

The type returned in the event of a conversion error.

impl<'_> TryFrom<&'_ RawResponse> for Capabilities[src]

type Error = Error

The type returned in the event of a conversion error.

fn try_from(resp: &RawResponse) -> Result<Self>[src]

Parse capabilities from a response

The specific format is taken from RFC 3977

impl<'_> TryFrom<&'_ RawResponse> for Group[src]

type Error = Error

The type returned in the event of a conversion error.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.