[−][src]Struct brokaw::types::response::BinaryArticle
A binary Netnews article
A BinaryArticle
is created by calling try_from
with a RawResponse
.
For text articles, consider converting this article into a TextArticle
.
Implementation Notes
Articles aim to follow RFC 3977 as closely as possible while remaining ergonomic.
- Response parsing will fail if the header names are not UTF-8
- The header contents will be lossily converted to UTF-8
- There are no formatting constraints on the body
Implementations
impl BinaryArticle
[src]
pub fn number(&self) -> ArticleNumber
[src]
The number of the article relative to the group it was retrieved from
pub fn message_id(&self) -> &str
[src]
The message id of the article
pub fn headers(&self) -> &Headers
[src]
The headers on the article
pub fn body(&self) -> &[u8]
[src]
The raw contents of the body
pub fn lines_len(&self) -> usize
[src]
The number of lines in the body
pub fn lines(&self) -> Lines
[src]
An iterator over the lines in the body of the article
pub fn unterminated(&self) -> Unterminated
[src]
An iterator over the lines of the body without the CRLF terminators
pub fn to_text(&self) -> Result<TextArticle>
[src]
Convert the article into a TextArticle
This will return an error if the body is not valid UTF-8
pub fn to_text_lossy(&self) -> TextArticle
[src]
Convert the article into a TextArticle
including invalid characters.
This function is analogous to calling is String::from_utf8_lossy
on every line in the body
Trait Implementations
impl Clone for BinaryArticle
[src]
fn clone(&self) -> BinaryArticle
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for BinaryArticle
[src]
impl Display for BinaryArticle
[src]
impl Eq for BinaryArticle
[src]
impl PartialEq<BinaryArticle> for BinaryArticle
[src]
fn eq(&self, other: &BinaryArticle) -> bool
[src]
fn ne(&self, other: &BinaryArticle) -> bool
[src]
impl StructuralEq for BinaryArticle
[src]
impl StructuralPartialEq for BinaryArticle
[src]
impl<'_> TryFrom<&'_ RawResponse> for BinaryArticle
[src]
Auto Trait Implementations
impl RefUnwindSafe for BinaryArticle
impl Send for BinaryArticle
impl Sync for BinaryArticle
impl Unpin for BinaryArticle
impl UnwindSafe for BinaryArticle
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,