pub fn serialize_header(head: NtpPacketHeader) -> Vec<u8> {
    let mut buff = Cursor::new(Vec::new());
    let first = create_first(head.leap_indicator, head.version, head.mode);
    buff.write_u8(first)
        .expect("write to buffer failed, unable to serialize NtpPacketHeader");
    buff.write_u8(head.stratum)
        .expect("write to buffer failed, unable to serialize NtpPacketHeader");
    buff.write_i8(head.poll)
        .expect("write to buffer failed, unable to serialize NtpPacketHeader");
    buff.write_i8(head.precision)
        .expect("write to buffer failed, unable to serialize NtpPacketHeader");
    buff.write_u32::<BigEndian>(head.root_delay)
        .expect("write to buffer failed, unable to serialize NtpPacketHeader");
    buff.write_u32::<BigEndian>(head.root_dispersion)
        .expect("write to buffer failed, unable to serialize NtpPacketHeader");
    buff.write_u32::<BigEndian>(head.reference_id)
        .expect("write to buffer failed, unable to serialize NtpPacketHeader");
    buff.write_u64::<BigEndian>(head.reference_timestamp)
        .expect("write to buffer failed, unable to serialize NtpPacketHeader");
    buff.write_u64::<BigEndian>(head.origin_timestamp)
        .expect("write to buffer failed, unable to serialize NtpPacketHeader");
    buff.write_u64::<BigEndian>(head.receive_timestamp)
        .expect("write to buffer failed, unable to serialize NtpPacketHeader");
    buff.write_u64::<BigEndian>(head.transmit_timestamp)
        .expect("write to buffer failed, unable to serialize NtpPacketHeader");
    buff.into_inner()
}
/// serialize_header returns a Vec<u8> containing the wire
/// format of the header.
serialize_header returns a Vec containing the wire
format of the header.
serialize_header returns a Vec containing the wire format of the header .
pub fn serialize_header(head: NtpPacketHeader) -> Vec<u8> {
    let mut buff = Cursor::new(Vec::new());
    let first = create_first(head.leap_indicator, head.version, head.mode);
    buff.write_u8(first)
        .expect("write to buffer failed, unable to serialize NtpPacketHeader");
    buff.write_u8(head.stratum)
        .expect("write to buffer failed, unable to serialize NtpPacketHeader");
    buff.write_i8(head.poll)
        .expect("write to buffer failed, unable to serialize NtpPacketHeader");
    buff.write_i8(head.precision)
        .expect("write to buffer failed, unable to serialize NtpPacketHeader");
    buff.write_u32::<BigEndian>(head.root_delay)
        .expect("write to buffer failed, unable to serialize NtpPacketHeader");
    buff.write_u32::<BigEndian>(head.root_dispersion)
        .expect("write to buffer failed, unable to serialize NtpPacketHeader");
    buff.write_u32::<BigEndian>(head.reference_id)
        .expect("write to buffer failed, unable to serialize NtpPacketHeader");
    buff.write_u64::<BigEndian>(head.reference_timestamp)
        .expect("write to buffer failed, unable to serialize NtpPacketHeader");
    buff.write_u64::<BigEndian>(head.origin_timestamp)
        .expect("write to buffer failed, unable to serialize NtpPacketHeader");
    buff.write_u64::<BigEndian>(head.receive_timestamp)
        .expect("write to buffer failed, unable to serialize NtpPacketHeader");
    buff.write_u64::<BigEndian>(head.transmit_timestamp)
        .expect("write to buffer failed, unable to serialize NtpPacketHeader");
    buff.into_inner()
}
pub fn serialize_header ( head : NtpPacketHeader ) -> Vec < u8 > { let mut buff = Cursor :: new ( Vec :: new ( ) ) ; let first = create_first ( head . leap_indicator , head . version , head . mode ) ; buff . write_u8 ( first ) . expect ( " " ) ; buff . write_u8 ( head . stratum ) . expect ( " " ) ; buff . write_i8 ( head . poll ) . expect ( " " ) ; buff . write_i8 ( head . precision ) . expect ( " " ) ; buff . write_u32 :: < BigEndian > ( head . root_delay ) . expect ( " " ) ; buff . write_u32 :: < BigEndian > ( head . root_dispersion ) . expect ( " " ) ; buff . write_u32 :: < BigEndian > ( head . reference_id ) . expect ( " " ) ; buff . write_u64 :: < BigEndian > ( head . reference_timestamp ) . expect ( " " ) ; buff . write_u64 :: < BigEndian > ( head . origin_timestamp ) . expect ( " " ) ; buff . write_u64 :: < BigEndian > ( head . receive_timestamp ) . expect ( " " ) ; buff . write_u64 :: < BigEndian > ( head . transmit_timestamp ) . expect ( " " ) ; buff . into_inner ( ) }
serialize_header returns a Vec<u8> containing the wire
format of the header.
serialize_header returns a Vec<u8 > containing the wire format of the header .
head
NtpPacketHeader
head
NtpPacketHeader