[][src]Trait tendril::fmt::Format

pub unsafe trait Format {
    pub fn validate(buf: &[u8]) -> bool;

    pub fn validate_prefix(buf: &[u8]) -> bool { ... }
pub fn validate_suffix(buf: &[u8]) -> bool { ... }
pub fn validate_subseq(buf: &[u8]) -> bool { ... }
pub unsafe fn fixup(_lhs: &[u8], _rhs: &[u8]) -> Fixup { ... } }

Trait for format marker types.

The type implementing this trait is usually not instantiated. It's used with a phantom type parameter of Tendril.

Required methods

pub fn validate(buf: &[u8]) -> bool[src]

Check whether the buffer is valid for this format.

Loading content...

Provided methods

pub fn validate_prefix(buf: &[u8]) -> bool[src]

Check whether the buffer is valid for this format.

You may assume the buffer is a prefix of a valid buffer.

pub fn validate_suffix(buf: &[u8]) -> bool[src]

Check whether the buffer is valid for this format.

You may assume the buffer is a suffix of a valid buffer.

pub fn validate_subseq(buf: &[u8]) -> bool[src]

Check whether the buffer is valid for this format.

You may assume the buffer is a contiguous subsequence of a valid buffer, but not necessarily a prefix or a suffix.

pub unsafe fn fixup(_lhs: &[u8], _rhs: &[u8]) -> Fixup[src]

Compute any fixup needed when concatenating buffers.

The default is to do nothing.

The function is unsafe because it may assume the input buffers are already valid for the format. Also, no bounds-checking is performed on the return value!

Loading content...

Implementors

impl Format for ASCII[src]

impl Format for Bytes[src]

impl Format for Latin1[src]

impl Format for UTF8[src]

impl Format for WTF8[src]

Loading content...