owned_ttf_parser

Trait FromData

Source
pub trait FromData: Sized {
    const SIZE: usize;

    // Required method
    fn parse(data: &[u8]) -> Option<Self>;
}
Expand description

A trait for parsing raw binary data of fixed size.

This is a low-level, internal trait that should not be used directly.

Required Associated Constants§

Source

const SIZE: usize

Object’s raw data size.

Not always the same as mem::size_of.

Required Methods§

Source

fn parse(data: &[u8]) -> Option<Self>

Parses an object from a raw data.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl FromData for Option<Offset16>

Source§

const SIZE: usize = 2usize

Source§

fn parse(data: &[u8]) -> Option<Option<Offset16>>

Source§

impl FromData for Option<Offset32>

Source§

const SIZE: usize = 4usize

Source§

fn parse(data: &[u8]) -> Option<Option<Offset32>>

Source§

impl FromData for i8

Source§

const SIZE: usize = 1usize

Source§

fn parse(data: &[u8]) -> Option<i8>

Source§

impl FromData for i16

Source§

const SIZE: usize = 2usize

Source§

fn parse(data: &[u8]) -> Option<i16>

Source§

impl FromData for i32

Source§

const SIZE: usize = 4usize

Source§

fn parse(data: &[u8]) -> Option<i32>

Source§

impl FromData for u8

Source§

const SIZE: usize = 1usize

Source§

fn parse(data: &[u8]) -> Option<u8>

Source§

impl FromData for u16

Source§

const SIZE: usize = 2usize

Source§

fn parse(data: &[u8]) -> Option<u16>

Source§

impl FromData for u32

Source§

const SIZE: usize = 4usize

Source§

fn parse(data: &[u8]) -> Option<u32>

Source§

impl FromData for u64

Source§

const SIZE: usize = 8usize

Source§

fn parse(data: &[u8]) -> Option<u64>

Source§

impl FromData for ()

Source§

const SIZE: usize = 0usize

Source§

fn parse(_: &[u8]) -> Option<()>

Implementors§