Skip to main content

is_bitwise_decode

Function is_bitwise_decode 

Source
pub const fn is_bitwise_decode<T>() -> bool
where T: for<'de> Decode<'de, Binary, Disabled>,
Expand description

Test if the given type T is marked with the #[musli(packed)] attribute, and is bitwise encodeable in the Binary mode using the Disabled allocator.

See the help section for #[musli(packed)] for more information.

ยงExamples

use musli::{is_bitwise_decode, Encode, Decode};

#[derive(Encode, Decode)]
#[musli(packed)]
struct Color {
    red: u32,
    green: u32,
    blue: u32,
}

assert!(is_bitwise_decode::<Color>());