Skip to main content

TypedElement

Trait TypedElement 

Source
pub trait TypedElement: Pod + Sealed {
    // Required method
    fn matches_layout_with_packing(
        layout: SampleLayout,
        access: BitPackingAccess,
    ) -> bool;

    // Provided method
    fn matches_layout(layout: SampleLayout) -> bool { ... }
}
Expand description

Sealed marker trait for Rust scalar, channel-array, or pixel types that carry a known SampleLayout compatibility contract.

Enforced by PixelBuf::from_typed, PixelView::from_typed, PixelView::row_as, PixelViewMut::row_as_mut, PixelBuf::row_as, and as_contiguous_typed* to prevent silent reinterpretation across mismatched sample types, channel orders, or non-Full bit packing (e.g. Rgba<u8> on BGRA8, u16 on RGBF16, or u16 on P010).

For intentional raw-POD byte reinterpretation (such as viewing f32 bits as u32 or custom #[repr(C)] POD pixel structs), use the explicit *_transmute* methods.

Required Methods§

Source

fn matches_layout_with_packing( layout: SampleLayout, access: BitPackingAccess, ) -> bool

Whether this element type is semantically compatible with layout under an explicit BitPackingAccess policy.

Provided Methods§

Source

fn matches_layout(layout: SampleLayout) -> bool

Whether this element type is semantically compatible with layout under default BitPackingAccess::Fail (requiring BitPacking::Full).

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl TypedElement for f32

Source§

impl TypedElement for f64

Source§

impl TypedElement for i8

Source§

impl TypedElement for i16

Source§

impl TypedElement for i32

Source§

impl TypedElement for i64

Source§

impl TypedElement for u8

Source§

impl TypedElement for u16

Source§

impl TypedElement for u32

Source§

impl TypedElement for u64

Source§

impl<S> TypedElement for Bgr<S>
where S: StorageSample,

Source§

impl<S> TypedElement for Bgra<S>
where S: StorageSample,

Source§

impl<S> TypedElement for GrayAlpha_v08<S>
where S: StorageSample,

Source§

impl<S> TypedElement for Gray_v08<S>
where S: StorageSample,

Source§

impl<S> TypedElement for Rgb<S>
where S: StorageSample,

Source§

impl<S> TypedElement for Rgba<S>
where S: StorageSample,

Source§

impl<S> TypedElement for [S; 1]
where S: StorageSample,

Source§

impl<S> TypedElement for [S; 2]
where S: StorageSample,

Source§

impl<S> TypedElement for [S; 3]
where S: StorageSample,

Source§

impl<S> TypedElement for [S; 4]
where S: StorageSample,

Source§

impl<S> TypedElement for [S; 5]
where S: StorageSample,

Implementors§