bin_proto/impls/unit.rs
1use bitstream_io::{BitRead, BitWrite, Endianness};
2
3use crate::{BitDecode, BitEncode, Result};
4
5impl<Ctx> BitDecode<Ctx> for () {
6 fn decode<R, E>(_: &mut R, _: &mut Ctx, (): ()) -> Result<Self>
7 where
8 R: BitRead,
9 E: Endianness,
10 {
11 Ok(())
12 }
13}
14
15impl<Ctx> BitEncode<Ctx> for () {
16 fn encode<W, E>(&self, _: &mut W, _: &mut Ctx, (): ()) -> Result<()>
17 where
18 W: BitWrite,
19 E: Endianness,
20 {
21 Ok(())
22 }
23}
24
25test_codec!((); () => []);
26test_roundtrip!(());