Skip to main content

is_bitwise_encode

Function is_bitwise_encode 

Source
pub const fn is_bitwise_encode<T>() -> bool
where T: Encode<Binary>,
Expand description

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

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

ยงExamples

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

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

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