BitDecode

Trait BitDecode 

Source
pub trait BitDecode<Ctx = (), Tag = ()>: Sized {
    // Required method
    fn decode<R, E>(read: &mut R, ctx: &mut Ctx, tag: Tag) -> Result<Self>
       where R: BitRead,
             E: Endianness;
}
Expand description

A trait for bit-level decoding.

Required Methods§

Source

fn decode<R, E>(read: &mut R, ctx: &mut Ctx, tag: Tag) -> Result<Self>
where R: BitRead, E: Endianness,

Reads self from a stream.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<Ctx> BitDecode<Ctx> for bool

Source§

fn decode<R, E>(read: &mut R, _: &mut Ctx, (): ()) -> Result<Self>
where R: BitRead, E: Endianness,

Source§

impl<Ctx> BitDecode<Ctx> for f32

Source§

fn decode<R, E>(read: &mut R, _: &mut Ctx, (): ()) -> Result<Self>
where R: BitRead, E: Endianness,

Source§

impl<Ctx> BitDecode<Ctx> for f64

Source§

fn decode<R, E>(read: &mut R, _: &mut Ctx, (): ()) -> Result<Self>
where R: BitRead, E: Endianness,

Source§

impl<Ctx> BitDecode<Ctx> for i8

Source§

fn decode<R, E>(read: &mut R, _: &mut Ctx, (): ()) -> Result<Self>
where R: BitRead, E: Endianness,

Source§

impl<Ctx> BitDecode<Ctx> for i16

Source§

fn decode<R, E>(read: &mut R, _: &mut Ctx, (): ()) -> Result<Self>
where R: BitRead, E: Endianness,

Source§

impl<Ctx> BitDecode<Ctx> for i32

Source§

fn decode<R, E>(read: &mut R, _: &mut Ctx, (): ()) -> Result<Self>
where R: BitRead, E: Endianness,

Source§

impl<Ctx> BitDecode<Ctx> for i64

Source§

fn decode<R, E>(read: &mut R, _: &mut Ctx, (): ()) -> Result<Self>
where R: BitRead, E: Endianness,

Source§

impl<Ctx> BitDecode<Ctx> for i128

Source§

fn decode<R, E>(read: &mut R, _: &mut Ctx, (): ()) -> Result<Self>
where R: BitRead, E: Endianness,

Source§

impl<Ctx> BitDecode<Ctx> for isize

Source§

fn decode<R, E>(read: &mut R, _: &mut Ctx, (): ()) -> Result<Self>
where R: BitRead, E: Endianness,

Source§

impl<Ctx> BitDecode<Ctx> for u8

Source§

fn decode<R, E>(read: &mut R, _: &mut Ctx, (): ()) -> Result<Self>
where R: BitRead, E: Endianness,

Source§

impl<Ctx> BitDecode<Ctx> for u16

Source§

fn decode<R, E>(read: &mut R, _: &mut Ctx, (): ()) -> Result<Self>
where R: BitRead, E: Endianness,

Source§

impl<Ctx> BitDecode<Ctx> for u32

Source§

fn decode<R, E>(read: &mut R, _: &mut Ctx, (): ()) -> Result<Self>
where R: BitRead, E: Endianness,

Source§

impl<Ctx> BitDecode<Ctx> for u64

Source§

fn decode<R, E>(read: &mut R, _: &mut Ctx, (): ()) -> Result<Self>
where R: BitRead, E: Endianness,

Source§

impl<Ctx> BitDecode<Ctx> for u128

Source§

fn decode<R, E>(read: &mut R, _: &mut Ctx, (): ()) -> Result<Self>
where R: BitRead, E: Endianness,

Source§

impl<Ctx> BitDecode<Ctx> for ()

Source§

fn decode<R, E>(_: &mut R, _: &mut Ctx, (): ()) -> Result<Self>
where R: BitRead, E: Endianness,

Source§

impl<Ctx> BitDecode<Ctx> for usize

Source§

fn decode<R, E>(read: &mut R, _: &mut Ctx, (): ()) -> Result<Self>
where R: BitRead, E: Endianness,

Source§

impl<Ctx> BitDecode<Ctx> for Box<CStr>

Available on crate feature alloc only.
Source§

fn decode<R, E>(read: &mut R, ctx: &mut Ctx, tag: ()) -> Result<Self>
where R: BitRead, E: Endianness,

Source§

impl<Ctx> BitDecode<Ctx> for CString

Available on crate feature alloc only.
Source§

fn decode<R, E>(read: &mut R, ctx: &mut Ctx, tag: ()) -> Result<Self>
where R: BitRead, E: Endianness,

Source§

impl<Ctx> BitDecode<Ctx> for PhantomPinned

Source§

fn decode<R, E>(_: &mut R, _: &mut Ctx, (): ()) -> Result<Self>
where R: BitRead, E: Endianness,

Source§

impl<Ctx> BitDecode<Ctx> for Ipv4Addr

Source§

fn decode<R, E>(read: &mut R, ctx: &mut Ctx, tag: ()) -> Result<Self>
where R: BitRead, E: Endianness,

Source§

impl<Ctx> BitDecode<Ctx> for Ipv6Addr

Source§

fn decode<R, E>(read: &mut R, ctx: &mut Ctx, tag: ()) -> Result<Self>
where R: BitRead, E: Endianness,

Source§

impl<Ctx> BitDecode<Ctx> for NonZeroI8

Source§

fn decode<R, E>(read: &mut R, _: &mut Ctx, (): ()) -> Result<Self>
where R: BitRead, E: Endianness,

Source§

impl<Ctx> BitDecode<Ctx> for NonZeroI16

Source§

fn decode<R, E>(read: &mut R, _: &mut Ctx, (): ()) -> Result<Self>
where R: BitRead, E: Endianness,

Source§

impl<Ctx> BitDecode<Ctx> for NonZeroI32

Source§

fn decode<R, E>(read: &mut R, _: &mut Ctx, (): ()) -> Result<Self>
where R: BitRead, E: Endianness,

Source§

impl<Ctx> BitDecode<Ctx> for NonZeroI64

Source§

fn decode<R, E>(read: &mut R, _: &mut Ctx, (): ()) -> Result<Self>
where R: BitRead, E: Endianness,

Source§

impl<Ctx> BitDecode<Ctx> for NonZeroI128

Source§

fn decode<R, E>(read: &mut R, _: &mut Ctx, (): ()) -> Result<Self>
where R: BitRead, E: Endianness,

Source§

impl<Ctx> BitDecode<Ctx> for NonZeroIsize

Source§

fn decode<R, E>(read: &mut R, _: &mut Ctx, (): ()) -> Result<Self>
where R: BitRead, E: Endianness,

Source§

impl<Ctx> BitDecode<Ctx> for NonZeroU8

Source§

fn decode<R, E>(read: &mut R, _: &mut Ctx, (): ()) -> Result<Self>
where R: BitRead, E: Endianness,

Source§

impl<Ctx> BitDecode<Ctx> for NonZeroU16

Source§

fn decode<R, E>(read: &mut R, _: &mut Ctx, (): ()) -> Result<Self>
where R: BitRead, E: Endianness,

Source§

impl<Ctx> BitDecode<Ctx> for NonZeroU32

Source§

fn decode<R, E>(read: &mut R, _: &mut Ctx, (): ()) -> Result<Self>
where R: BitRead, E: Endianness,

Source§

impl<Ctx> BitDecode<Ctx> for NonZeroU64

Source§

fn decode<R, E>(read: &mut R, _: &mut Ctx, (): ()) -> Result<Self>
where R: BitRead, E: Endianness,

Source§

impl<Ctx> BitDecode<Ctx> for NonZeroU128

Source§

fn decode<R, E>(read: &mut R, _: &mut Ctx, (): ()) -> Result<Self>
where R: BitRead, E: Endianness,

Source§

impl<Ctx> BitDecode<Ctx> for NonZeroUsize

Source§

fn decode<R, E>(read: &mut R, _: &mut Ctx, (): ()) -> Result<Self>
where R: BitRead, E: Endianness,

Source§

impl<Ctx> BitDecode<Ctx, Untagged> for Box<str>

Available on crate feature alloc only.
Source§

fn decode<R, E>(read: &mut R, ctx: &mut Ctx, tag: Untagged) -> Result<Self>
where R: BitRead, E: Endianness,

Source§

impl<Ctx> BitDecode<Ctx, Untagged> for String

Available on crate feature alloc only.
Source§

fn decode<R, E>(read: &mut R, ctx: &mut Ctx, _: Untagged) -> Result<Self>
where R: BitRead, E: Endianness,

Source§

impl<Ctx, K, V> BitDecode<Ctx, Untagged> for BTreeMap<K, V>
where K: BitDecode<Ctx> + Ord, V: BitDecode<Ctx>,

Available on crate feature alloc only.
Source§

fn decode<R, E>(read: &mut R, ctx: &mut Ctx, _: Untagged) -> Result<Self>
where R: BitRead, E: Endianness,

Source§

impl<Ctx, K, V, H> BitDecode<Ctx, Untagged> for HashMap<K, V, H>
where K: BitDecode<Ctx> + Eq + Hash, V: BitDecode<Ctx>, H: BuildHasher + Default,

Available on crate feature std only.
Source§

fn decode<R, E>(read: &mut R, ctx: &mut Ctx, _: Untagged) -> Result<Self>
where R: BitRead, E: Endianness,

Source§

impl<Ctx, T> BitDecode<Ctx> for PhantomData<T>

Source§

fn decode<R, E>(_: &mut R, _: &mut Ctx, (): ()) -> Result<Self>
where R: BitRead, E: Endianness,

Source§

impl<Ctx, T> BitDecode<Ctx, Untagged> for Box<[T]>
where T: BitDecode<Ctx>,

Available on crate feature alloc only.
Source§

fn decode<R, E>(read: &mut R, ctx: &mut Ctx, tag: Untagged) -> Result<Self>
where R: BitRead, E: Endianness,

Source§

impl<Ctx, T> BitDecode<Ctx, Untagged> for BinaryHeap<T>
where T: BitDecode<Ctx> + Ord,

Available on crate feature alloc only.
Source§

fn decode<R, E>(read: &mut R, ctx: &mut Ctx, _: Untagged) -> Result<Self>
where R: BitRead, E: Endianness,

Source§

impl<Ctx, T> BitDecode<Ctx, Untagged> for BTreeSet<T>
where T: BitDecode<Ctx> + Ord,

Available on crate feature alloc only.
Source§

fn decode<R, E>(read: &mut R, ctx: &mut Ctx, _: Untagged) -> Result<Self>
where R: BitRead, E: Endianness,

Source§

impl<Ctx, T> BitDecode<Ctx, Untagged> for LinkedList<T>
where T: BitDecode<Ctx>,

Available on crate feature alloc only.
Source§

fn decode<R, E>(read: &mut R, ctx: &mut Ctx, _: Untagged) -> Result<Self>
where R: BitRead, E: Endianness,

Source§

impl<Ctx, T> BitDecode<Ctx, Untagged> for VecDeque<T>
where T: BitDecode<Ctx>,

Available on crate feature alloc only.
Source§

fn decode<R, E>(read: &mut R, ctx: &mut Ctx, _: Untagged) -> Result<Self>
where R: BitRead, E: Endianness,

Source§

impl<Ctx, T> BitDecode<Ctx, Untagged> for Vec<T>
where T: BitDecode<Ctx>,

Available on crate feature alloc only.
Source§

fn decode<R, E>(read: &mut R, ctx: &mut Ctx, _: Untagged) -> Result<Self>
where R: BitRead, E: Endianness,

Source§

impl<Ctx, T, H> BitDecode<Ctx, Untagged> for HashSet<T, H>
where T: BitDecode<Ctx> + Hash + Eq, H: BuildHasher + Default,

Available on crate feature std only.
Source§

fn decode<R, E>(read: &mut R, ctx: &mut Ctx, _: Untagged) -> Result<Self>
where R: BitRead, E: Endianness,

Source§

impl<Ctx, T, const N: usize> BitDecode<Ctx> for [T; N]
where T: BitDecode<Ctx>,

Source§

fn decode<R, E>(read: &mut R, ctx: &mut Ctx, (): ()) -> Result<Self>
where R: BitRead, E: Endianness,

Source§

impl<Ctx, Tag, T> BitDecode<Ctx, Tag> for (T₁, T₂, …, Tₙ)
where T: BitDecode<Ctx, Tag>,

This trait is implemented for tuples with up to 16 items.

Source§

fn decode<R, E>(read: &mut R, ctx: &mut Ctx, tag: Tag) -> Result<Self>
where R: BitRead, E: Endianness,

Source§

impl<Ctx, Tag, T> BitDecode<Ctx, Tag> for Box<T>
where T: BitDecode<Ctx, Tag>,

Available on crate feature alloc only.
Source§

fn decode<R, E>(read: &mut R, ctx: &mut Ctx, tag: Tag) -> Result<Self>
where R: BitRead, E: Endianness,

Source§

impl<Ctx, Tag, T> BitDecode<Ctx, Tag> for Rc<T>
where T: BitDecode<Ctx, Tag>,

Available on crate feature alloc only.
Source§

fn decode<R, E>(read: &mut R, ctx: &mut Ctx, tag: Tag) -> Result<Self>
where R: BitRead, E: Endianness,

Source§

impl<Ctx, Tag, T> BitDecode<Ctx, Tag> for Arc<T>
where T: BitDecode<Ctx, Tag>,

Available on crate feature alloc only.
Source§

fn decode<R, E>(read: &mut R, ctx: &mut Ctx, tag: Tag) -> Result<Self>
where R: BitRead, E: Endianness,

Source§

impl<Ctx, Tag, T> BitDecode<Ctx, Tag> for Saturating<T>
where T: BitDecode<Ctx, Tag>,

Source§

fn decode<R, E>(read: &mut R, ctx: &mut Ctx, tag: Tag) -> Result<Self>
where R: BitRead, E: Endianness,

Source§

impl<Ctx, Tag, T> BitDecode<Ctx, Tag> for Wrapping<T>
where T: BitDecode<Ctx, Tag>,

Source§

fn decode<R, E>(read: &mut R, ctx: &mut Ctx, tag: Tag) -> Result<Self>
where R: BitRead, E: Endianness,

Source§

impl<Ctx, const C: u32> BitDecode<Ctx, Bits<C>> for bool

Source§

fn decode<R, E>(read: &mut R, _: &mut Ctx, _: Bits<C>) -> Result<Self>
where R: BitRead, E: Endianness,

Source§

impl<Ctx, const C: u32> BitDecode<Ctx, Bits<C>> for i8

Source§

fn decode<R, E>(read: &mut R, _: &mut Ctx, _: Bits<C>) -> Result<Self>
where R: BitRead, E: Endianness,

Source§

impl<Ctx, const C: u32> BitDecode<Ctx, Bits<C>> for i16

Source§

fn decode<R, E>(read: &mut R, _: &mut Ctx, _: Bits<C>) -> Result<Self>
where R: BitRead, E: Endianness,

Source§

impl<Ctx, const C: u32> BitDecode<Ctx, Bits<C>> for i32

Source§

fn decode<R, E>(read: &mut R, _: &mut Ctx, _: Bits<C>) -> Result<Self>
where R: BitRead, E: Endianness,

Source§

impl<Ctx, const C: u32> BitDecode<Ctx, Bits<C>> for i64

Source§

fn decode<R, E>(read: &mut R, _: &mut Ctx, _: Bits<C>) -> Result<Self>
where R: BitRead, E: Endianness,

Source§

impl<Ctx, const C: u32> BitDecode<Ctx, Bits<C>> for isize

Source§

fn decode<R, E>(read: &mut R, _: &mut Ctx, _: Bits<C>) -> Result<Self>
where R: BitRead, E: Endianness,

Source§

impl<Ctx, const C: u32> BitDecode<Ctx, Bits<C>> for u8

Source§

fn decode<R, E>(read: &mut R, _: &mut Ctx, _: Bits<C>) -> Result<Self>
where R: BitRead, E: Endianness,

Source§

impl<Ctx, const C: u32> BitDecode<Ctx, Bits<C>> for u16

Source§

fn decode<R, E>(read: &mut R, _: &mut Ctx, _: Bits<C>) -> Result<Self>
where R: BitRead, E: Endianness,

Source§

impl<Ctx, const C: u32> BitDecode<Ctx, Bits<C>> for u32

Source§

fn decode<R, E>(read: &mut R, _: &mut Ctx, _: Bits<C>) -> Result<Self>
where R: BitRead, E: Endianness,

Source§

impl<Ctx, const C: u32> BitDecode<Ctx, Bits<C>> for u64

Source§

fn decode<R, E>(read: &mut R, _: &mut Ctx, _: Bits<C>) -> Result<Self>
where R: BitRead, E: Endianness,

Source§

impl<Ctx, const C: u32> BitDecode<Ctx, Bits<C>> for usize

Source§

fn decode<R, E>(read: &mut R, _: &mut Ctx, _: Bits<C>) -> Result<Self>
where R: BitRead, E: Endianness,

Source§

impl<Ctx, const C: u32> BitDecode<Ctx, Bits<C>> for NonZeroI8

Source§

fn decode<R, E>(read: &mut R, _: &mut Ctx, _: Bits<C>) -> Result<Self>
where R: BitRead, E: Endianness,

Source§

impl<Ctx, const C: u32> BitDecode<Ctx, Bits<C>> for NonZeroI16

Source§

fn decode<R, E>(read: &mut R, _: &mut Ctx, _: Bits<C>) -> Result<Self>
where R: BitRead, E: Endianness,

Source§

impl<Ctx, const C: u32> BitDecode<Ctx, Bits<C>> for NonZeroI32

Source§

fn decode<R, E>(read: &mut R, _: &mut Ctx, _: Bits<C>) -> Result<Self>
where R: BitRead, E: Endianness,

Source§

impl<Ctx, const C: u32> BitDecode<Ctx, Bits<C>> for NonZeroIsize

Source§

fn decode<R, E>(read: &mut R, _: &mut Ctx, _: Bits<C>) -> Result<Self>
where R: BitRead, E: Endianness,

Source§

impl<Ctx, const C: u32> BitDecode<Ctx, Bits<C>> for NonZeroU8

Source§

fn decode<R, E>(read: &mut R, _: &mut Ctx, _: Bits<C>) -> Result<Self>
where R: BitRead, E: Endianness,

Source§

impl<Ctx, const C: u32> BitDecode<Ctx, Bits<C>> for NonZeroU16

Source§

fn decode<R, E>(read: &mut R, _: &mut Ctx, _: Bits<C>) -> Result<Self>
where R: BitRead, E: Endianness,

Source§

impl<Ctx, const C: u32> BitDecode<Ctx, Bits<C>> for NonZeroU32

Source§

fn decode<R, E>(read: &mut R, _: &mut Ctx, _: Bits<C>) -> Result<Self>
where R: BitRead, E: Endianness,

Source§

impl<Ctx, const C: u32> BitDecode<Ctx, Bits<C>> for NonZeroUsize

Source§

fn decode<R, E>(read: &mut R, _: &mut Ctx, _: Bits<C>) -> Result<Self>
where R: BitRead, E: Endianness,

Source§

impl<Tag, Ctx> BitDecode<Ctx, Tag<Tag>> for Box<str>
where Tag: TryInto<usize>,

Available on crate feature alloc only.
Source§

fn decode<R, E>(read: &mut R, ctx: &mut Ctx, tag: Tag<Tag>) -> Result<Self>
where R: BitRead, E: Endianness,

Source§

impl<Tag, Ctx> BitDecode<Ctx, Tag<Tag>> for String
where Tag: TryInto<usize>,

Available on crate feature alloc only.
Source§

fn decode<R, E>(read: &mut R, ctx: &mut Ctx, tag: Tag<Tag>) -> Result<Self>
where R: BitRead, E: Endianness,

Source§

impl<Tag, Ctx, K, V> BitDecode<Ctx, Tag<Tag>> for BTreeMap<K, V>
where K: BitDecode<Ctx> + Ord, V: BitDecode<Ctx>, Tag: TryInto<usize>,

Available on crate feature alloc only.
Source§

fn decode<R, E>(read: &mut R, ctx: &mut Ctx, tag: Tag<Tag>) -> Result<Self>
where R: BitRead, E: Endianness,

Source§

impl<Tag, Ctx, K, V, H> BitDecode<Ctx, Tag<Tag>> for HashMap<K, V, H>
where K: BitDecode<Ctx> + Eq + Hash, V: BitDecode<Ctx>, Tag: TryInto<usize>, H: BuildHasher + Default,

Available on crate feature std only.
Source§

fn decode<R, E>(read: &mut R, ctx: &mut Ctx, tag: Tag<Tag>) -> Result<Self>
where R: BitRead, E: Endianness,

Source§

impl<Tag, Ctx, T> BitDecode<Ctx, Tag<Tag>> for Option<T>
where T: BitDecode<Ctx>, Tag: TryInto<bool>,

Source§

fn decode<R, E>(read: &mut R, ctx: &mut Ctx, tag: Tag<Tag>) -> Result<Self>
where R: BitRead, E: Endianness,

Source§

impl<Tag, Ctx, T> BitDecode<Ctx, Tag<Tag>> for Box<[T]>
where T: BitDecode<Ctx>, Tag: TryInto<usize>,

Available on crate feature alloc only.
Source§

fn decode<R, E>(read: &mut R, ctx: &mut Ctx, tag: Tag<Tag>) -> Result<Self>
where R: BitRead, E: Endianness,

Source§

impl<Tag, Ctx, T> BitDecode<Ctx, Tag<Tag>> for BinaryHeap<T>
where T: BitDecode<Ctx> + Ord, Tag: TryInto<usize>,

Available on crate feature alloc only.
Source§

fn decode<R, E>(read: &mut R, ctx: &mut Ctx, tag: Tag<Tag>) -> Result<Self>
where R: BitRead, E: Endianness,

Source§

impl<Tag, Ctx, T> BitDecode<Ctx, Tag<Tag>> for BTreeSet<T>
where T: BitDecode<Ctx> + Ord, Tag: TryInto<usize>,

Available on crate feature alloc only.
Source§

fn decode<R, E>(read: &mut R, ctx: &mut Ctx, tag: Tag<Tag>) -> Result<Self>
where R: BitRead, E: Endianness,

Source§

impl<Tag, Ctx, T> BitDecode<Ctx, Tag<Tag>> for LinkedList<T>
where T: BitDecode<Ctx>, Tag: TryInto<usize>,

Available on crate feature alloc only.
Source§

fn decode<R, E>(read: &mut R, ctx: &mut Ctx, tag: Tag<Tag>) -> Result<Self>
where R: BitRead, E: Endianness,

Source§

impl<Tag, Ctx, T> BitDecode<Ctx, Tag<Tag>> for VecDeque<T>
where T: BitDecode<Ctx>, Tag: TryInto<usize>,

Available on crate feature alloc only.
Source§

fn decode<R, E>(read: &mut R, ctx: &mut Ctx, tag: Tag<Tag>) -> Result<Self>
where R: BitRead, E: Endianness,

Source§

impl<Tag, Ctx, T> BitDecode<Ctx, Tag<Tag>> for Vec<T>
where T: BitDecode<Ctx>, Tag: TryInto<usize>,

Available on crate feature alloc only.
Source§

fn decode<R, E>(read: &mut R, ctx: &mut Ctx, tag: Tag<Tag>) -> Result<Self>
where R: BitRead, E: Endianness,

Source§

impl<Tag, Ctx, T, H> BitDecode<Ctx, Tag<Tag>> for HashSet<T, H>
where T: BitDecode<Ctx> + Hash + Eq, Tag: TryInto<usize>, H: BuildHasher + Default,

Available on crate feature std only.
Source§

fn decode<R, E>(read: &mut R, ctx: &mut Ctx, tag: Tag<Tag>) -> Result<Self>
where R: BitRead, E: Endianness,

Implementors§