Skip to main content

ZeroCopySource

Trait ZeroCopySource 

Source
pub trait ZeroCopySource {
    // Required method
    fn view(&self) -> BorrowedView<'_>;

    // Provided methods
    fn len(&self) -> usize { ... }
    fn is_empty(&self) -> bool { ... }
}
Expand description

Trait for types that can provide a zero-copy view of their contents.

Required Methods§

Source

fn view(&self) -> BorrowedView<'_>

Get a borrowed view of the data.

Provided Methods§

Source

fn len(&self) -> usize

Get the length of the data.

Source

fn is_empty(&self) -> bool

Check if the data is empty.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl ZeroCopySource for Bytes

Source§

fn view(&self) -> BorrowedView<'_>

Source§

impl ZeroCopySource for String

Source§

fn view(&self) -> BorrowedView<'_>

Source§

impl ZeroCopySource for Vec<u8>

Source§

fn view(&self) -> BorrowedView<'_>

Source§

impl ZeroCopySource for [u8]

Source§

fn view(&self) -> BorrowedView<'_>

Source§

impl ZeroCopySource for str

Source§

fn view(&self) -> BorrowedView<'_>

Implementors§