Struct read_fonts::FontData

source ·
pub struct FontData<'a> { /* private fields */ }
Expand description

A reference to raw binary font data.

This is a wrapper around a byte slice, that provides convenience methods for parsing and validating that data.

Implementations§

Create a new FontData with these bytes.

You generally don’t need to do this? It is handled for you when loading data from disk, but may be useful in tests.

The length of the data, in bytes

true if the data has a length of zero bytes.

Read a scalar value out of the buffer at offset, elliding bounds checks

Safety

The range offset..offset + T::RAW_BYTE_LEN must be in bounds.

Interpret the bytes at offset as a reference to some type T.

Safety

T must be a struct or scalar that has alignment of 1, a non-zero size, and no internal padding, and range must have a length that is non-zero and is a multiple of size_of::<T>().

Trait Implementations§

Converts this type into a shared reference of the (usually inferred) input type.
Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more
Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.