Struct evdi::buffer::Buffer[][src]

pub struct Buffer {
    pub version: Option<u32>,
    pub id: BufferId,
    pub width: usize,
    pub height: usize,
    pub stride: usize,
    pub pixel_format: Result<DrmFormat, UnrecognizedFourcc>,
    // some fields omitted
}

A buffer used to store the virtual screen pixels.

Fields

version: Option<u32>

None if the buffer never been written to, otherwise Some(n) where n increases by some amount every time the buffer is written to.

let timeout = Duration::from_secs(1);
let buf_id = handle.new_buffer(&mode);

assert!(handle.get_buffer(buf_id).expect("Buffer exists").version.is_none());

handle.request_update(buf_id, timeout).await?;
let after_first = handle
    .get_buffer(buf_id).expect("buffer exists")
    .version.expect("Buffer must have been updated");

handle.request_update(buf_id, timeout).await?;
let after_second = handle
    .get_buffer(buf_id).expect("buffer exists")
    .version.expect("Buffer must have been updated");

assert!(after_second > after_first);
id: BufferIdwidth: usizeheight: usizestride: usizepixel_format: Result<DrmFormat, UnrecognizedFourcc>

Implementations

impl Buffer[src]

Owned and created by Handles. The general flow is

let buffer_id: BufferId = handle.new_buffer(&mode);
let buffer_data: &Buffer = handle.get_buffer(buffer_id).expect("Buffer exists");

handle.unregister_buffer(buffer_id);
assert!(handle.get_buffer(buffer_id).is_none());

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

Get a reference to the underlying bytes of this buffer.

Use Buffer::width, Buffer::height, Buffer::stride, and Buffer::pixel_format to interpret this.

pub fn rects(&self) -> &[evdi_rect][src]

pub fn debug_write_to_ppm(&self, f: &mut File) -> Result<()>[src]

Write the pixels to a file in the unoptimized image format PPM.

This is useful when debugging, as you can open the file in an image viewer and see if the buffer is processed correctly.

Panics: If the pixel format isn’t Xbgr8888, to simplify the implementation. This function should therefore only be used as a debug helper where you can guarantee that your kernel won’t output in a different format.

Trait Implementations

impl Debug for Buffer[src]

fn fmt(&self, __f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

Auto Trait Implementations

impl RefUnwindSafe for Buffer

impl Send for Buffer

impl Sync for Buffer

impl Unpin for Buffer

impl UnwindSafe for Buffer

Blanket Implementations

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

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

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

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

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

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

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

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T> Instrument for T[src]

fn instrument(self, span: Span) -> Instrumented<Self>[src]

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

fn in_current_span(self) -> Instrumented<Self>[src]

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

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.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

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.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 

pub fn vzip(self) -> V