fn write_bytes<O: fmt::Write>(&self, out: &mut O, bytes: &[u8]) -> usize {
        match self {
            Type::Primitive(primitive) => primitive.write_bytes(out, bytes),
            Type::Array(primitive, size) => {
                let mut written = 0;
                let required_size = primitive.size() * size;

                if required_size > bytes.len() {
                    return written;
                }

                for chunk in bytes.chunks_exact(required_size) {
                    out.write_str("[").expect("to write string");
                    written += primitive.write_bytes(out, chunk);
                    out.write_str("],").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 {
            Type::Primitive(primitive) => primitive.write_bytes(out, bytes),
            Type::Array(primitive, size) => {
                let mut written = 0;
                let required_size = primitive.size() * size;
                if required_size > bytes.len() {
                    return written;
                }
                for chunk in bytes.chunks_exact(required_size) {
                    out.write_str("[").expect("to write string");
                    written += primitive.write_bytes(out, chunk);
                    out.write_str("],").expect("to write string");
                }
                written
            },
        }
    }
fn write_bytes < O : fmt :: Write > ( & self , out : & mut O , bytes : & [ u8 ] ) -> usize { match self { Type :: Primitive ( primitive ) => primitive . write_bytes ( out , bytes ) , Type :: Array ( primitive , size ) => { let mut written = 0 ; let required_size = primitive . size ( ) * size ; if required_size > bytes . len ( ) { return written ; } for chunk in bytes . chunks_exact ( required_size ) { out . write_str ( " " ) . expect ( " " ) ; written += primitive . write_bytes ( out , chunk ) ; out . write_str ( " " ) . expect ( " " ) ; } written } , } }
returns number of bytes written.
returns number of bytes written .
&self
out
&mut O
bytes
&[u8]
&self
out
&mut O
bytes
&[u8]