oca 0.2.0

An experiment with no_std
Documentation
use crate::{
    ocp1::pdu::{Handle, parameters::Parameters},
    types::OcaMethod,
};

#[derive(Debug, Copy, Clone, Eq, PartialEq)]
pub struct Command<'a> {
    pub handle: Handle,
    pub method: OcaMethod,
    pub parameters: Parameters<'a>,
}

#[derive(Debug, Copy, Clone, Eq, PartialEq)]
pub struct CommandResponseRequired<'a>(Command<'a>);

impl<'a> AsRef<Command<'a>> for CommandResponseRequired<'a> {
    fn as_ref(&self) -> &Command<'a> {
        &self.0
    }
}

impl<'a> From<Command<'a>> for CommandResponseRequired<'a> {
    fn from(command: Command<'a>) -> Self {
        Self(command)
    }
}

impl<'a> From<CommandResponseRequired<'a>> for Command<'a> {
    fn from(CommandResponseRequired(command): CommandResponseRequired<'a>) -> Self {
        command
    }
}