Struct riffu::fourcc::FourCC [−][src]
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
- 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.
- 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
.
Auto Trait Implementations
impl RefUnwindSafe for FourCC
[src]
impl Send for FourCC
[src]
impl Sync for FourCC
[src]
impl Unpin for FourCC
[src]
impl UnwindSafe for FourCC
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,