Struct riffu::fourcc::FourCC[][src]

pub struct FourCC { /* fields omitted */ }

Implementations

impl FourCC[src]

Represents the ASCII identifier of a chunk.

Example

use riffu::FourCC;
let good = FourCC::new(b"1234");
// let bad = FourCC::new(b"12345"); // won't compile

NOTE

  1. AFAIK, the only valid identifier is in ASCII. I am not entirely sure what all the possible value ASCII can take. So we need to enforce correctness on that front too.
  2. Are there other conversions that we are missing out on?

pub fn new(data: &[u8]) -> RiffResult<FourCC>[src]

pub fn as_bytes(&self) -> &[u8; 4][src]

View &self struct as a &[u8].

pub fn into_bytes(self) -> [u8; 4][src]

Consume self and returns a [u8; 4].

Trait Implementations

impl Clone for FourCC[src]

impl Debug for FourCC[src]

impl TryFrom<&'_ [u8]> for FourCC[src]

A &[u8] can be converted to a FourCC.

type Error = RiffError

The type returned in the event of a conversion error.

fn try_from(value: &[u8]) -> Result<Self, Self::Error>[src]

Performs the conversion.

use riffu::FourCC;
use std::convert::TryInto;
let buffer: &[u8] = &[80u8, 80u8, 80u8,80u8];
let test: FourCC = buffer.try_into().unwrap();

impl TryFrom<&'_ str> for FourCC[src]

A &str can be converted to a FourCC.

type Error = RiffError

The type returned in the event of a conversion error.

fn try_from(value: &str) -> Result<Self, Self::Error>[src]

Performs the conversion.

use riffu::FourCC;
use std::convert::TryInto;
let test : FourCC = "test".try_into().unwrap();

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.