Struct Framebuffer

Source
pub struct Framebuffer {
    pub device: File,
    pub frame: MmapMut,
    pub var_screen_info: VarScreeninfo,
    pub fix_screen_info: FixScreeninfo,
}
Expand description

Struct that should be used to work with the framebuffer. Direct usage of frame should not be necessary.

Fields§

§device: File§frame: MmapMut§var_screen_info: VarScreeninfo§fix_screen_info: FixScreeninfo

Implementations§

Source§

impl Framebuffer

Source

pub fn new<P: AsRef<Path>>( path_to_device: P, ) -> Result<Framebuffer, FramebufferError>

Source

pub fn write_frame(&mut self, frame: &[u8])

Writes a frame to the Framebuffer.

Source

pub fn read_frame(&self) -> &[u8]

Reads a frame from the framebuffer.

Source

pub fn get_fix_screeninfo( device: &File, ) -> Result<FixScreeninfo, FramebufferError>

Creates a FixScreeninfo struct and fills it using ioctl.

Source

pub fn get_var_screeninfo( device: &File, ) -> Result<VarScreeninfo, FramebufferError>

Creates a VarScreeninfo struct and fills it using ioctl.

Source

pub fn put_var_screeninfo( device: &File, screeninfo: &VarScreeninfo, ) -> Result<i32, FramebufferError>

Source

pub fn pan_display( device: &File, screeninfo: &VarScreeninfo, ) -> Result<i32, FramebufferError>

Source

pub fn set_kd_mode(kd_mode: KdMode) -> Result<i32, FramebufferError>

Sets the tty graphics mode. Make sure to change it back to KdMode::Text after the program is done!

Source

pub fn set_kd_mode_ex<P: AsRef<Path>>( path_to_device: P, kd_mode: KdMode, ) -> Result<i32, FramebufferError>

Allows setting tty mode from non-terminal session by explicitly specifying device name

Trait Implementations§

Source§

impl Debug for Framebuffer

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

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

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

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

Source§

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

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.