[][src]Struct v4l::buffers::mmap::MappedBuffer

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

Memory mapped buffer

The buffer is backed by camera device or kernel memory. Read only access (e.g. by directly uploading it to the GPU) is permitted for the lifetime of the buffer instance. Acquiring ownership of the data in userspace is not possible, so it has to be copied.

Implementations

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

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

Returns a mapped memory region representation

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

Arguments

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

Example

use v4l::{buffer, MappedBuffer, Timestamp};

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

Trait Implementations

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

Auto Trait Implementations

impl<'a> RefUnwindSafe for MappedBuffer<'a>

impl<'a> Send for MappedBuffer<'a>

impl<'a> Sync for MappedBuffer<'a>

impl<'a> Unpin for MappedBuffer<'a>

impl<'a> UnwindSafe for MappedBuffer<'a>

Blanket Implementations

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

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

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

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

impl<T, U> Into<U> for T where
    U: From<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.