[][src]Struct v4l::buffer::Buffer

pub struct Buffer<'a> { /* fields omitted */ }

Represents a buffer view


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

pub fn new(view: &'a [u8], meta: Metadata) -> Self[src]

Returns a memory region view

Buffers created this way provide read-only access to the backing data, enforcing callers to copy the data before mutating it.


  • view - Slice of raw memory
  • meta - Metadata, usually filled in by the driver


use v4l::{buffer, timestamp};

let data: Vec<u8> = Vec::new();
let ts = timestamp::Timestamp::new(0 /* sec */, 0 /* usec */);
let flags = buffer::Flags::from(0);
let meta = buffer::Metadata::new(0, ts, flags);
let buf = buffer::Buffer::new(&data, meta);

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

Slice of read-only data

pub fn meta(&self) -> &Metadata[src]

Metadata such as allocation flags, timestamp and more

Trait Implementations

impl<'a> Deref for Buffer<'a>[src]

type Target = [u8]

The resulting type after dereferencing.

Auto Trait Implementations

impl<'a> RefUnwindSafe for Buffer<'a>

impl<'a> Send for Buffer<'a>

impl<'a> Sync for Buffer<'a>

impl<'a> Unpin for Buffer<'a>

impl<'a> UnwindSafe for Buffer<'a>

Blanket Implementations

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

impl<T> Borrow<T> for T where
    T: ?Sized

impl<T> BorrowMut<T> for T where
    T: ?Sized

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.