macro_rules! impl_try_unpack_for_owned {
    (impl TryOwnedUnpack for $t:ty { $($rest:tt)* }) => { ... };
    ($t:ty) => { ... };
}
Expand description

Provides an automatic implementation of TryUnpack when wrapped around an implementation of TryOwnedUnpack.

§Example

The following usage will create an implementation of the TryUnpack trait for Vec<u8> that uses the given implementation of TryOwnedUnpack:

# use spinel_pack::{TryOwnedUnpack, prelude::*};
impl_try_unpack_for_owned! {
    impl TryOwnedUnpack for Vec<u8> {
        type Unpacked = Self;
        fn try_owned_unpack(iter: &mut std::slice::Iter<'_, u8>) -> anyhow::Result<Self::Unpacked> {
            Ok(<&[u8]>::try_unpack(iter)?.to_owned())
        }
    }
}