Skip to main content

FbInfo

Struct FbInfo 

Source
pub struct FbInfo {
    pub size: Size,
    pub stride_bytes: u32,
    pub bits_per_pixel: u32,
    pub layout: PixelLayout,
}
Expand description

The geometry of a framebuffer.

Fields§

§size: Size

Visible extent in pixels.

§stride_bytes: u32

Distance between the starts of consecutive rows, in bytes.

fbdev calls this line_length, and it is routinely wider than width * bytes_per_pixel. Assuming otherwise is the classic fbdev bug: a picture that shears diagonally on hardware and looks fine in a VM.

§bits_per_pixel: u32

Bit depth as reported.

§layout: PixelLayout

Inferred pixel layout.

Implementations§

Source§

impl FbInfo

Source

pub fn from_sysfs( virtual_size: &str, modes: &str, stride: &str, bits_per_pixel: &str, ) -> Result<Self, FbInfoError>

Builds the geometry from raw sysfs attribute contents.

modes is preferred for the visible extent because virtual_size includes any area reserved for panning, which on a double-buffered framebuffer is twice the height of what is actually on screen.

Source

pub fn required_bytes(&self) -> usize

Bytes the mapping must cover for this geometry.

Source

pub fn stride_pixels(&self) -> Option<u32>

Row stride in pixels, when that is a whole number.

Trait Implementations§

Source§

impl Clone for FbInfo

Source§

fn clone(&self) -> FbInfo

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for FbInfo

Source§

impl Debug for FbInfo

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Display for FbInfo

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Eq for FbInfo

Source§

impl PartialEq for FbInfo

Source§

fn eq(&self, other: &FbInfo) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for FbInfo

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.