async_proto/impls/
uuid.rs

1use {
2    uuid::Uuid,
3    async_proto_derive::impl_protocol_for,
4    crate::Protocol,
5};
6
7#[derive(Protocol)]
8#[async_proto(internal)]
9struct UuidProxy(uuid::Bytes);
10
11impl From<UuidProxy> for Uuid {
12    fn from(UuidProxy(bytes): UuidProxy) -> Self {
13        Self::from_bytes(bytes)
14    }
15}
16
17impl<'a> From<&'a Uuid> for UuidProxy {
18    fn from(uuid: &Uuid) -> Self {
19        Self(uuid.into_bytes())
20    }
21}
22
23impl_protocol_for! {
24    #[async_proto(attr(cfg_attr(docsrs, doc(cfg(feature = "uuid")))))]
25    #[async_proto(via = UuidProxy)]
26    type Uuid;
27}