use std::num::NonZeroU16;
use crate::connection::{IpmiCommand, Message, NetFn, NotEnoughData};
pub struct ReserveSel;
impl IpmiCommand for ReserveSel {
type Output = NonZeroU16;
type Error = NotEnoughData;
fn parse_success_response(data: &[u8]) -> Result<Self::Output, Self::Error> {
if data.len() < 2 {
return Err(NotEnoughData);
}
let reservation_id = u16::from_le_bytes([data[0], data[1]]);
NonZeroU16::new(reservation_id).ok_or(NotEnoughData)
}
}
impl From<ReserveSel> for Message {
fn from(_: ReserveSel) -> Self {
Message::new_request(NetFn::Storage, 0x42, Vec::new())
}
}