Skip to main content

CBT

Struct CBT 

Source
pub struct CBT {
    pub header: CBTHeader,
    pub frames: Vec<Vec<u8>>,
}

Fields§

§header: CBTHeader§frames: Vec<Vec<u8>>

Implementations§

Source§

impl CBT

Source

pub fn new_from_bytes(bytes: &[u8]) -> Result<CBT, CBTError>

Creates a new CBT from the given bytes. Bytes should be the entire contents of a CBT file.

Source

pub fn new_empty(width: u16, height: u16, with_alpha_channel: bool) -> CBT

Creates a new CBT with no data contained and a frame count of 0. Preferably use new_with_capacity instead, to save cpu time.

Source

pub fn new_with_capacity( width: u16, height: u16, frame_count: u16, with_alpha_channel: bool, ) -> CBT

Creates a new CBT with a pre-allocated frame count. Preferred over new_empty, to save cpu time.

Source

pub fn fill_frame(&mut self, frame_index: usize, data: &[u8])

Inserts the given data into the frame at the given index.

Source

pub fn to_file_data(&self) -> Vec<u8> ⓘ

Converts the CBT struct to a byte array that would be in the CBT file format.

Source

pub fn get_reader(&self, with_alpha_channel: bool) -> CBTReader

Returns a CBTReader that can be used to read the frames in a specific format. This should only be used if you’re too lazy to do the correct readings yourself, as it will consume a lot of memory.

Trait Implementations§

Source§

impl Debug for CBT

Source§

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

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

impl PartialEq for CBT

Source§

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

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

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

Inequality operator !=. Read more

Auto Trait Implementations§

§

impl Freeze for CBT

§

impl RefUnwindSafe for CBT

§

impl Send for CBT

§

impl Sync for CBT

§

impl Unpin for CBT

§

impl UnsafeUnpin for CBT

§

impl UnwindSafe for CBT

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 = !

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.