messagepack-async 0.2.3

A simple functional library for read/writing messagepack with tokio.
Documentation
use super::Value;

#[derive(Clone, Debug, PartialEq)]
pub struct Ext {
    pub r#type: u8,
    pub data: Vec<u8>,
}

impl From<(u8, Vec<u8>)> for Ext {
    fn from((r#type, data): (u8, Vec<u8>)) -> Self {
        Ext { r#type, data }
    }
}

impl From<(u8, &[u8])> for Ext {
    fn from((r#type, data): (u8, &[u8])) -> Self {
        Ext {
            r#type,
            data: data.into(),
        }
    }
}

impl From<(u8, Vec<u8>)> for Value {
    fn from(value: (u8, Vec<u8>)) -> Self {
        Value::Ext(value.into())
    }
}

impl From<(u8, &[u8])> for Value {
    fn from(value: (u8, &[u8])) -> Self {
        Value::Ext(value.into())
    }
}