1//! Deprecated, see [`binary::bits`]
2#![deprecated(since = "0.4.2", note = "Replaced with `binary::bits`")]
3
4use crate::binary;
5use crate::error::{ErrorConvert, ParseError};
6use crate::lib::std::ops::{AddAssign, Shl, Shr};
7use crate::stream::{AsBytes, Stream, StreamIsPartial, ToUsize};
8use crate::{IResult, Parser};
9
10/// Deprecated, replaced with [`binary::bits::bits`]
11#[deprecated(since = "0.4.2", note = "Replaced with `binary::bits::bits`")]
12#[inline(always)]
13pub fn bits<I, O, E1, E2, P>(parser: P) -> impl Parser<I, O, E2>
14where
15 E1: ParseError<(I, usize)> + ErrorConvert<E2>,
16 E2: ParseError<I>,
17 I: Stream,
18 P: Parser<(I, usize), O, E1>,
19{
20 binary::bits::bits(parser)
21}
22
23/// Deprecated, replaced with [`binary::bits::bytes`]
24#[deprecated(since = "0.4.2", note = "Replaced with `binary::bits::bytes`")]
25#[inline(always)]
26pub fn bytes<I, O, E1, E2, P>(parser: P) -> impl Parser<(I, usize), O, E2>
27where
28 E1: ParseError<I> + ErrorConvert<E2>,
29 E2: ParseError<(I, usize)>,
30 I: Stream<Token = u8>,
31 P: Parser<I, O, E1>,
32{
33 binary::bits::bytes(parser)
34}
35
36/// Deprecated, replaced with [`binary::bits::take`]
37#[deprecated(since = "0.4.2", note = "Replaced with `binary::bits::take`")]
38#[inline(always)]
39pub fn take<I, O, C, E: ParseError<(I, usize)>>(count: C) -> impl Parser<(I, usize), O, E>
40where
41 I: Stream<Token = u8> + AsBytes + StreamIsPartial,
42 C: ToUsize,
43 O: From<u8> + AddAssign + Shl<usize, Output = O> + Shr<usize, Output = O>,
44{
45 binary::bits::take(count)
46}
47
48/// Deprecated, replaced with [`binary::bits::tag`]
49#[deprecated(since = "0.4.2", note = "Replaced with `binary::bits::tag`")]
50#[inline(always)]
51pub fn tag<I, O, C, E: ParseError<(I, usize)>>(
52 pattern: O,
53 count: C,
54) -> impl Parser<(I, usize), O, E>
55where
56 I: Stream<Token = u8> + AsBytes + StreamIsPartial,
57 C: ToUsize,
58 O: From<u8> + AddAssign + Shl<usize, Output = O> + Shr<usize, Output = O> + PartialEq,
59{
60 binary::bits::tag(pattern, count)
61}
62
63/// Deprecated, replaced with [`binary::bits::bool`]
64#[deprecated(since = "0.4.2", note = "Replaced with `binary::bits::bool`")]
65#[inline(always)]
66pub fn bool<I, E: ParseError<(I, usize)>>(input: (I, usize)) -> IResult<(I, usize), bool, E>
67where
68 I: Stream<Token = u8> + AsBytes + StreamIsPartial,
69{
70 binary::bits::bool(input)
71}
72