capnp_conv 0.4.1

Provides capnp write/read traits to convert from structs to readers/builders
Documentation
use capnp::{traits::Owned, Result};
pub use capnp_conv_macros::capnp_conv;

pub trait Writable {
    type OwnedType: Owned;

    fn write(&self, builder: <Self::OwnedType as Owned>::Builder<'_>);
}

pub trait Readable
where
    Self: Sized,
{
    type OwnedType: Owned;

    fn read(reader: <Self::OwnedType as Owned>::Reader<'_>) -> Result<Self>;
}

pub trait RemoteEnum<T> {
    fn to_capnp_enum(&self) -> T;
    fn try_from_capnp_enum(other: &T) -> Result<Self>
    where
        Self: Sized;
}