artiq/artiq/firmware/libproto/analyzer_proto.rs

23 lines
579 B
Rust
Raw Normal View History

2016-10-05 13:59:38 +08:00
use std::io::{self, Write};
use io::*;
2016-10-05 13:59:38 +08:00
#[derive(Debug)]
pub struct Header {
pub sent_bytes: u32,
pub total_byte_count: u64,
pub overflow_occurred: bool,
pub log_channel: u8,
pub dds_onehot_sel: bool
}
impl Header {
pub fn write_to(&self, writer: &mut Write) -> io::Result<()> {
write_u32(writer, self.sent_bytes)?;
write_u64(writer, self.total_byte_count)?;
write_u8(writer, self.overflow_occurred as u8)?;
write_u8(writer, self.log_channel)?;
write_u8(writer, self.dds_onehot_sel as u8)?;
2016-10-05 13:59:38 +08:00
Ok(())
}
}