pub fn serialize<T: KeRecordTrait>(record: T) -> Vec<u8> {
    let mut result = Vec::new();

    // The first 16 bits will comprise a critical bit and the record type.
    let first_word: u16 = (u16::from(record.critical()) << 15) + T::record_type();
    result.append(&mut Vec::from(&first_word.to_be_bytes()[..]));

    // The second 16 bits will be the length of the record body.
    result.append(&mut Vec::from(&record.len().to_be_bytes()[..]));

    // The rest is the content of the record.
    result.append(&mut record.into_bytes());

    result
}
/// Serialize the record into the network-ready format.
Serialize the record into the network-ready format.
Serialize the record into the network - ready format .
pub fn serialize<T: KeRecordTrait>(record: T) -> Vec<u8> {
    let mut result = Vec::new();
    // The first 16 bits will comprise a critical bit and the record type.
    let first_word: u16 = (u16::from(record.critical()) << 15) + T::record_type();
    result.append(&mut Vec::from(&first_word.to_be_bytes()[..]));
    // The second 16 bits will be the length of the record body.
    result.append(&mut Vec::from(&record.len().to_be_bytes()[..]));
    // The rest is the content of the record.
    result.append(&mut record.into_bytes());
    result
}
pub fn serialize < T : KeRecordTrait > ( record : T ) -> Vec < u8 > { let mut result = Vec :: new ( ) ; // The first 16 bits will comprise a critical bit and the record type. let first_word : u16 = ( u16 :: from ( record . critical ( ) ) << 15 ) + T :: record_type ( ) ; result . append ( & mut Vec :: from ( & first_word . to_be_bytes ( ) [ .. ] ) ) ; // The second 16 bits will be the length of the record body. result . append ( & mut Vec :: from ( & record . len ( ) . to_be_bytes ( ) [ .. ] ) ) ; // The rest is the content of the record. result . append ( & mut record . into_bytes ( ) ) ; result }
Serialize the record into the network-ready format.
Serialize the record into the network - ready format .
record
T
record
T