fn assert_roundtrip_eq<T>(nbt: T, bytes: &[u8], name: Option<&str>)
where
    for<'de> T: serde::Serialize + serde::Deserialize<'de> + PartialEq + std::fmt::Debug,
{
    let mut dst = Vec::with_capacity(bytes.len());

    nbt::ser::to_writer(&mut dst, &nbt, name).expect("NBT serialization.");
    assert_eq!(bytes, &dst[..]);

    let read: T = nbt::de::from_reader(bytes).expect("NBT deserialization.");
    assert_eq!(read, nbt);
}
/// Helper function that asserts data of type T can be serialized into and
/// deserialized from `bytes`. `name` is an optional header for the top-level
/// NBT compound.
Helper function that asserts data of type T can be serialized into and
deserialized from `bytes`. `name` is an optional header for the top-level
NBT compound.
Helper function that asserts data of type T can be serialized into and deserialized from ` bytes ` . ` name ` is an optional header for the top - level NBT compound .
fn assert_roundtrip_eq<T>(nbt: T, bytes: &[u8], name: Option<&str>)
where
    for<'de> T: serde::Serialize + serde::Deserialize<'de> + PartialEq + std::fmt::Debug,
{
    let mut dst = Vec::with_capacity(bytes.len());
    nbt::ser::to_writer(&mut dst, &nbt, name).expect("NBT serialization.");
    assert_eq!(bytes, &dst[..]);
    let read: T = nbt::de::from_reader(bytes).expect("NBT deserialization.");
    assert_eq!(read, nbt);
}
fn assert_roundtrip_eq < T > ( nbt : T , bytes : & [ u8 ] , name : Option < & str > ) where for < ' de > T : serde :: Serialize + serde :: Deserialize < ' de > + PartialEq + std :: fmt :: Debug , { let mut dst = Vec :: with_capacity ( bytes . len ( ) ) ; nbt :: ser :: to_writer ( & mut dst , & nbt , name ) . expect ( " " ) ; assert_eq ! ( bytes dst [ ] ) ; let read : T = nbt :: de :: from_reader ( bytes ) . expect ( " " ) ; assert_eq ! ( read nbt ) ; }
Helper function that asserts data of type T can be serialized into and
deserialized from `bytes`.
Helper function that asserts data of type T can be serialized into and deserialized from ` bytes ` .
nbt
T
bytes
&[u8]
name
Option<&str>