use std::io::{self, Read, Write};
use crate::io::{ReadFrom, WriteTo};
bitflags! {
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
pub struct Features: u32 {
const ONION_ROUTER = 1<<27;
const FORWARD_SECRECY = 1<<28;
const EXTENDED_ENCODING = 1<<29;
const INCLUDE_DESTINATION = 1<<30;
const DOES_ACK = 1<<31;
}
}
impl WriteTo for Features {
fn write_to(&self, w: &mut dyn Write) -> io::Result<()> {
self.bits().write_to(w)
}
}
impl ReadFrom for Features {
fn read_from(r: &mut dyn Read) -> io::Result<Self>
where
Self: Sized,
{
let bits = u32::read_from(r)?;
Ok(Self::from_bits_retain(bits))
}
}