litrs

Trait Buffer

Source
pub trait Buffer: Sealed + Deref<Target = str> {
    type Cow: From<String> + AsRef<str> + Borrow<str> + Deref<Target = str>;
    type ByteCow: From<Vec<u8>> + AsRef<[u8]> + Borrow<[u8]> + Deref<Target = [u8]>;
}
Expand description

A shared or owned string buffer. Implemented for String and &str. Implementation detail.

This is trait is implementation detail of this library, cannot be implemented in other crates and is not subject to semantic versioning. litrs only gurantees that this trait is implemented for String and for<'a> &'a str.

Required Associated Types§

Source

type Cow: From<String> + AsRef<str> + Borrow<str> + Deref<Target = str>

This is Cow<'static, str> for String, and Cow<'a, str> for &'a str.

Source

type ByteCow: From<Vec<u8>> + AsRef<[u8]> + Borrow<[u8]> + Deref<Target = [u8]>

This is Cow<'static, [u8]> for String, and Cow<'a, [u8]> for &'a str.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl Buffer for String

Source§

type Cow = Cow<'static, str>

Source§

type ByteCow = Cow<'static, [u8]>

Source§

impl<'a> Buffer for &'a str

Source§

type Cow = Cow<'a, str>

Source§

type ByteCow = Cow<'a, [u8]>

Implementors§