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: BufferId
width: usize
height: usize
stride: usize
pixel_format: Result<DrmFormat, UnrecognizedFourcc>
Implementations
impl Buffer
[src]
impl Buffer
[src]Owned and created by Handle
s. 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]
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]
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
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> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> Instrument for T
[src]
impl<T> Instrument for T
[src]fn instrument(self, span: Span) -> Instrumented<Self>
[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]
fn in_current_span(self) -> Instrumented<Self>
[src]impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,