[][src]Struct pgn_reader::RawHeader

pub struct RawHeader<'a>(pub &'a [u8]);

A header value.

Provides helper methods for decoding backslash escaped values.

A quote inside a string is represented by the backslash immediately followed by a quote. A backslash inside a string is represented by two adjacent backslashes.

Methods

impl<'a> RawHeader<'a>[src]

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

Returns the raw byte representation of the header value.

pub fn decode(&self) -> Cow<'a, [u8]>[src]

Decodes escaped quotes and backslashes into bytes. Allocates only when the value actually contains escape sequences.

pub fn decode_utf8(&self) -> Result<Cow<'a, str>, Utf8Error>[src]

Tries to decode the header as UTF-8. This is guaranteed to succeed on valid PGNs.

Errors

Errors if the header contains an invalid UTF-8 byte sequence.

pub fn decode_utf8_lossy(&self) -> Cow<'a, str>[src]

Decodes the header as UTF-8, replacing any invalid byte sequences with the placeholder � U+FFFD.

Trait Implementations

impl<'a> Clone for RawHeader<'a>[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl<'a> PartialEq<RawHeader<'a>> for RawHeader<'a>[src]

impl<'a> Eq for RawHeader<'a>[src]

impl<'a> Debug for RawHeader<'a>[src]

Auto Trait Implementations

impl<'a> Sync for RawHeader<'a>

impl<'a> Unpin for RawHeader<'a>

impl<'a> Send for RawHeader<'a>

impl<'a> UnwindSafe for RawHeader<'a>

impl<'a> RefUnwindSafe for RawHeader<'a>

Blanket Implementations

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> From<T> for T[src]

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.

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

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

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