pub struct FourCharCode(/* private fields */);Expand description
FourCharCode represents a 4-character code (used in Core Video/Media)
§Examples
use screencapturekit::FourCharCode;
// Create from string
let code: FourCharCode = "BGRA".parse().unwrap();
assert_eq!(code.display(), "BGRA");
// Create from bytes
let code = FourCharCode::from_bytes(*b"420v");
assert_eq!(code.as_u32(), 0x34323076);Implementations§
Source§impl FourCharCode
impl FourCharCode
Sourcepub const fn from_bytes(bytes: [u8; 4]) -> Self
pub const fn from_bytes(bytes: [u8; 4]) -> Self
Create a FourCharCode from exactly 4 bytes (infallible)
§Examples
use screencapturekit::FourCharCode;
let code = FourCharCode::from_bytes(*b"BGRA");
assert_eq!(code.display(), "BGRA");Sourcepub fn from_slice(bytes: &[u8]) -> Option<Self>
pub fn from_slice(bytes: &[u8]) -> Option<Self>
Create a FourCharCode from a byte slice
Sourcepub const fn as_u32(self) -> u32
pub const fn as_u32(self) -> u32
Get the u32 representation
§Examples
use screencapturekit::FourCharCode;
let code = FourCharCode::from_bytes(*b"BGRA");
let value: u32 = code.as_u32();
assert_eq!(value, 0x42475241);Sourcepub const fn from_u32(value: u32) -> Self
pub const fn from_u32(value: u32) -> Self
Create from a u32 value (const version of From trait)
Trait Implementations§
Source§impl Clone for FourCharCode
impl Clone for FourCharCode
Source§fn clone(&self) -> FourCharCode
fn clone(&self) -> FourCharCode
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for FourCharCode
impl Debug for FourCharCode
Source§impl Display for FourCharCode
impl Display for FourCharCode
Source§impl From<FourCharCode> for PixelFormat
impl From<FourCharCode> for PixelFormat
Source§fn from(val: FourCharCode) -> Self
fn from(val: FourCharCode) -> Self
Converts to this type from the input type.
Source§impl From<FourCharCode> for u32
impl From<FourCharCode> for u32
Source§fn from(code: FourCharCode) -> Self
fn from(code: FourCharCode) -> Self
Converts to this type from the input type.
Source§impl From<PixelFormat> for FourCharCode
impl From<PixelFormat> for FourCharCode
Source§fn from(val: PixelFormat) -> Self
fn from(val: PixelFormat) -> Self
Converts to this type from the input type.
Source§impl From<u32> for FourCharCode
impl From<u32> for FourCharCode
Source§impl FromStr for FourCharCode
impl FromStr for FourCharCode
Source§impl Hash for FourCharCode
impl Hash for FourCharCode
Source§impl PartialEq for FourCharCode
impl PartialEq for FourCharCode
impl Copy for FourCharCode
impl Eq for FourCharCode
impl StructuralPartialEq for FourCharCode
Auto Trait Implementations§
impl Freeze for FourCharCode
impl RefUnwindSafe for FourCharCode
impl Send for FourCharCode
impl Sync for FourCharCode
impl Unpin for FourCharCode
impl UnwindSafe for FourCharCode
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more