fn write_bytes<O: fmt::Write>(&self, out: &mut O, bytes: &[u8]) -> usize {
        match self {
            Primitive::U8 => {
                for byte in bytes {
                    core::fmt::write(out, format_args!("0x{:x}u8, ", byte)).expect("To write string");
                }
                bytes.len()
            },
            Primitive::U16 => {
                let mut written = 0;
                for chunk in bytes.chunks_exact(2) {
                    written += chunk.len();
                    let byte = u16::from_ne_bytes([chunk[0], chunk[1]]);
                    core::fmt::write(out, format_args!("0x{:x}u16, ", byte)).expect("To write string");
                }
                written
            },
            Primitive::U32 => {
                let mut written = 0;
                for chunk in bytes.chunks_exact(4) {
                    written += chunk.len();
                    let byte = u32::from_ne_bytes([chunk[0], chunk[1], chunk[2], chunk[3]]);
                    core::fmt::write(out, format_args!("0x{:x}u32, ", byte)).expect("To write string");
                }
                written
            }
            Primitive::U64 => {
                let mut written = 0;
                for chunk in bytes.chunks_exact(8) {
                    written += chunk.len();
                    let byte = u64::from_ne_bytes([chunk[0], chunk[1], chunk[2], chunk[3], chunk[4], chunk[5], chunk[6], chunk[7]]);
                    core::fmt::write(out, format_args!("0x{:x}u64, ", byte)).expect("To write string");
                }
                written
            },
            Primitive::U128 => {
                let mut written = 0;
                for chunk in bytes.chunks_exact(16) {
                    written += chunk.len();
                    let byte = u128::from_ne_bytes([chunk[0], chunk[1], chunk[2], chunk[3], chunk[4], chunk[5], chunk[6], chunk[7], chunk[8], chunk[9], chunk[10], chunk[11], chunk[12], chunk[13], chunk[14], chunk[15]]);
                    core::fmt::write(out, format_args!("0x{:x}u128, ", byte)).expect("To write string");
                }
                written
            },
        }
    }
///returns number of bytes written.
returns number of bytes written.
returns number of bytes written .
fn write_bytes<O: fmt::Write>(&self, out: &mut O, bytes: &[u8]) -> usize {
        match self {
            Primitive::U8 => {
                for byte in bytes {
                    core::fmt::write(out, format_args!("0x{:x}u8, ", byte)).expect("To write string");
                }
                bytes.len()
            },
            Primitive::U16 => {
                let mut written = 0;
                for chunk in bytes.chunks_exact(2) {
                    written += chunk.len();
                    let byte = u16::from_ne_bytes([chunk[0], chunk[1]]);
                    core::fmt::write(out, format_args!("0x{:x}u16, ", byte)).expect("To write string");
                }
                written
            },
            Primitive::U32 => {
                let mut written = 0;
                for chunk in bytes.chunks_exact(4) {
                    written += chunk.len();
                    let byte = u32::from_ne_bytes([chunk[0], chunk[1], chunk[2], chunk[3]]);
                    core::fmt::write(out, format_args!("0x{:x}u32, ", byte)).expect("To write string");
                }
                written
            }
            Primitive::U64 => {
                let mut written = 0;
                for chunk in bytes.chunks_exact(8) {
                    written += chunk.len();
                    let byte = u64::from_ne_bytes([chunk[0], chunk[1], chunk[2], chunk[3], chunk[4], chunk[5], chunk[6], chunk[7]]);
                    core::fmt::write(out, format_args!("0x{:x}u64, ", byte)).expect("To write string");
                }
                written
            },
            Primitive::U128 => {
                let mut written = 0;
                for chunk in bytes.chunks_exact(16) {
                    written += chunk.len();
                    let byte = u128::from_ne_bytes([chunk[0], chunk[1], chunk[2], chunk[3], chunk[4], chunk[5], chunk[6], chunk[7], chunk[8], chunk[9], chunk[10], chunk[11], chunk[12], chunk[13], chunk[14], chunk[15]]);
                    core::fmt::write(out, format_args!("0x{:x}u128, ", byte)).expect("To write string");
                }
                written
            },
        }
    }
fn write_bytes < O : fmt :: Write > ( & self , out : & mut O , bytes : & [ u8 ] ) -> usize { match self { Primitive :: U8 => { for byte in bytes { core :: fmt :: write ( out , format_args ! ( " " byte ) ) . expect ( " " ) ; } bytes . len ( ) } , Primitive :: U16 => { let mut written = 0 ; for chunk in bytes . chunks_exact ( 2 ) { written += chunk . len ( ) ; let byte = u16 :: from_ne_bytes ( [ chunk [ 0 ] , chunk [ 1 ] ] ) ; core :: fmt :: write ( out , format_args ! ( " " byte ) ) . expect ( " " ) ; } written } , Primitive :: U32 => { let mut written = 0 ; for chunk in bytes . chunks_exact ( 4 ) { written += chunk . len ( ) ; let byte = u32 :: from_ne_bytes ( [ chunk [ 0 ] , chunk [ 1 ] , chunk [ 2 ] , chunk [ 3 ] ] ) ; core :: fmt :: write ( out , format_args ! ( " " byte ) ) . expect ( " " ) ; } written } Primitive :: U64 => { let mut written = 0 ; for chunk in bytes . chunks_exact ( 8 ) { written += chunk . len ( ) ; let byte = u64 :: from_ne_bytes ( [ chunk [ 0 ] , chunk [ 1 ] , chunk [ 2 ] , chunk [ 3 ] , chunk [ 4 ] , chunk [ 5 ] , chunk [ 6 ] , chunk [ 7 ] ] ) ; core :: fmt :: write ( out , format_args ! ( " " byte ) ) . expect ( " " ) ; } written } , Primitive :: U128 => { let mut written = 0 ; for chunk in bytes . chunks_exact ( 16 ) { written += chunk . len ( ) ; let byte = u128 :: from_ne_bytes ( [ chunk [ 0 ] , chunk [ 1 ] , chunk [ 2 ] , chunk [ 3 ] , chunk [ 4 ] , chunk [ 5 ] , chunk [ 6 ] , chunk [ 7 ] , chunk [ 8 ] , chunk [ 9 ] , chunk [ 10 ] , chunk [ 11 ] , chunk [ 12 ] , chunk [ 13 ] , chunk [ 14 ] , chunk [ 15 ] ] ) ; core :: fmt :: write ( out , format_args ! ( " " byte ) ) . expect ( " " ) ; } written } , } }
returns number of bytes written.
returns number of bytes written .
&self
out
&mut O
bytes
&[u8]
&self
out
&mut O
bytes
&[u8]