/rust/registry/src/index.crates.io-1949cf8c6b5b557f/nom-7.1.3/src/traits.rs
Line | Count | Source |
1 | | //! Traits input types have to implement to work with nom combinators |
2 | | use crate::error::{ErrorKind, ParseError}; |
3 | | use crate::internal::{Err, IResult, Needed}; |
4 | | use crate::lib::std::iter::{Copied, Enumerate}; |
5 | | use crate::lib::std::ops::{Range, RangeFrom, RangeFull, RangeTo}; |
6 | | use crate::lib::std::slice::Iter; |
7 | | use crate::lib::std::str::from_utf8; |
8 | | use crate::lib::std::str::CharIndices; |
9 | | use crate::lib::std::str::Chars; |
10 | | use crate::lib::std::str::FromStr; |
11 | | |
12 | | #[cfg(feature = "alloc")] |
13 | | use crate::lib::std::string::String; |
14 | | #[cfg(feature = "alloc")] |
15 | | use crate::lib::std::vec::Vec; |
16 | | |
17 | | /// Abstract method to calculate the input length |
18 | | pub trait InputLength { |
19 | | /// Calculates the input length, as indicated by its name, |
20 | | /// and the name of the trait itself |
21 | | fn input_len(&self) -> usize; |
22 | | } |
23 | | |
24 | | impl<'a, T> InputLength for &'a [T] { |
25 | | #[inline] |
26 | 1.17G | fn input_len(&self) -> usize { |
27 | 1.17G | self.len() |
28 | 1.17G | } <&[u8] as nom::traits::InputLength>::input_len Line | Count | Source | 26 | 324M | fn input_len(&self) -> usize { | 27 | 324M | self.len() | 28 | 324M | } |
<&[u8] as nom::traits::InputLength>::input_len Line | Count | Source | 26 | 32.8M | fn input_len(&self) -> usize { | 27 | 32.8M | self.len() | 28 | 32.8M | } |
<&[u8] as nom::traits::InputLength>::input_len Line | Count | Source | 26 | 4.47M | fn input_len(&self) -> usize { | 27 | 4.47M | self.len() | 28 | 4.47M | } |
<&[u8] as nom::traits::InputLength>::input_len Line | Count | Source | 26 | 11.0M | fn input_len(&self) -> usize { | 27 | 11.0M | self.len() | 28 | 11.0M | } |
<&[u8] as nom::traits::InputLength>::input_len Line | Count | Source | 26 | 9.75M | fn input_len(&self) -> usize { | 27 | 9.75M | self.len() | 28 | 9.75M | } |
<&[u8] as nom::traits::InputLength>::input_len Line | Count | Source | 26 | 120k | fn input_len(&self) -> usize { | 27 | 120k | self.len() | 28 | 120k | } |
<&[u8] as nom::traits::InputLength>::input_len Line | Count | Source | 26 | 290k | fn input_len(&self) -> usize { | 27 | 290k | self.len() | 28 | 290k | } |
<&[u8] as nom::traits::InputLength>::input_len Line | Count | Source | 26 | 16.1M | fn input_len(&self) -> usize { | 27 | 16.1M | self.len() | 28 | 16.1M | } |
<&[u8] as nom::traits::InputLength>::input_len Line | Count | Source | 26 | 84.9k | fn input_len(&self) -> usize { | 27 | 84.9k | self.len() | 28 | 84.9k | } |
<&[u8] as nom::traits::InputLength>::input_len Line | Count | Source | 26 | 15.1k | fn input_len(&self) -> usize { | 27 | 15.1k | self.len() | 28 | 15.1k | } |
Unexecuted instantiation: <&[u8] as nom::traits::InputLength>::input_len Unexecuted instantiation: <&[_] as nom::traits::InputLength>::input_len <&[u8] as nom::traits::InputLength>::input_len Line | Count | Source | 26 | 724M | fn input_len(&self) -> usize { | 27 | 724M | self.len() | 28 | 724M | } |
<&[u8] as nom::traits::InputLength>::input_len Line | Count | Source | 26 | 9.14M | fn input_len(&self) -> usize { | 27 | 9.14M | self.len() | 28 | 9.14M | } |
<&[u8] as nom::traits::InputLength>::input_len Line | Count | Source | 26 | 12.5M | fn input_len(&self) -> usize { | 27 | 12.5M | self.len() | 28 | 12.5M | } |
<&[u8] as nom::traits::InputLength>::input_len Line | Count | Source | 26 | 7.97M | fn input_len(&self) -> usize { | 27 | 7.97M | self.len() | 28 | 7.97M | } |
<&[u8] as nom::traits::InputLength>::input_len Line | Count | Source | 26 | 262k | fn input_len(&self) -> usize { | 27 | 262k | self.len() | 28 | 262k | } |
<&[u8] as nom::traits::InputLength>::input_len Line | Count | Source | 26 | 23.4M | fn input_len(&self) -> usize { | 27 | 23.4M | self.len() | 28 | 23.4M | } |
<&[u8] as nom::traits::InputLength>::input_len Line | Count | Source | 26 | 174k | fn input_len(&self) -> usize { | 27 | 174k | self.len() | 28 | 174k | } |
<&[u8] as nom::traits::InputLength>::input_len Line | Count | Source | 26 | 934k | fn input_len(&self) -> usize { | 27 | 934k | self.len() | 28 | 934k | } |
<&[u8] as nom::traits::InputLength>::input_len Line | Count | Source | 26 | 2.44k | fn input_len(&self) -> usize { | 27 | 2.44k | self.len() | 28 | 2.44k | } |
Unexecuted instantiation: <&[u8] as nom::traits::InputLength>::input_len Unexecuted instantiation: <&[_] as nom::traits::InputLength>::input_len |
29 | | } |
30 | | |
31 | | impl<'a> InputLength for &'a str { |
32 | | #[inline] |
33 | 32.3M | fn input_len(&self) -> usize { |
34 | 32.3M | self.len() |
35 | 32.3M | } <&str as nom::traits::InputLength>::input_len Line | Count | Source | 33 | 5.23k | fn input_len(&self) -> usize { | 34 | 5.23k | self.len() | 35 | 5.23k | } |
<&str as nom::traits::InputLength>::input_len Line | Count | Source | 33 | 32.3M | fn input_len(&self) -> usize { | 34 | 32.3M | self.len() | 35 | 32.3M | } |
|
36 | | } |
37 | | |
38 | | impl<'a> InputLength for (&'a [u8], usize) { |
39 | | #[inline] |
40 | 180M | fn input_len(&self) -> usize { |
41 | | //println!("bit input length for ({:?}, {}):", self.0, self.1); |
42 | | //println!("-> {}", self.0.len() * 8 - self.1); |
43 | 180M | self.0.len() * 8 - self.1 |
44 | 180M | } <(&[u8], usize) as nom::traits::InputLength>::input_len Line | Count | Source | 40 | 112M | fn input_len(&self) -> usize { | 41 | | //println!("bit input length for ({:?}, {}):", self.0, self.1); | 42 | | //println!("-> {}", self.0.len() * 8 - self.1); | 43 | 112M | self.0.len() * 8 - self.1 | 44 | 112M | } |
<(&[u8], usize) as nom::traits::InputLength>::input_len Line | Count | Source | 40 | 68.5M | fn input_len(&self) -> usize { | 41 | | //println!("bit input length for ({:?}, {}):", self.0, self.1); | 42 | | //println!("-> {}", self.0.len() * 8 - self.1); | 43 | 68.5M | self.0.len() * 8 - self.1 | 44 | 68.5M | } |
|
45 | | } |
46 | | |
47 | | /// Useful functions to calculate the offset between slices and show a hexdump of a slice |
48 | | pub trait Offset { |
49 | | /// Offset between the first byte of self and the first byte of the argument |
50 | | fn offset(&self, second: &Self) -> usize; |
51 | | } |
52 | | |
53 | | impl Offset for [u8] { |
54 | 19.1M | fn offset(&self, second: &Self) -> usize { |
55 | 19.1M | let fst = self.as_ptr(); |
56 | 19.1M | let snd = second.as_ptr(); |
57 | | |
58 | 19.1M | snd as usize - fst as usize |
59 | 19.1M | } <[u8] as nom::traits::Offset>::offset Line | Count | Source | 54 | 12.6M | fn offset(&self, second: &Self) -> usize { | 55 | 12.6M | let fst = self.as_ptr(); | 56 | 12.6M | let snd = second.as_ptr(); | 57 | | | 58 | 12.6M | snd as usize - fst as usize | 59 | 12.6M | } |
<[u8] as nom::traits::Offset>::offset Line | Count | Source | 54 | 6.49M | fn offset(&self, second: &Self) -> usize { | 55 | 6.49M | let fst = self.as_ptr(); | 56 | 6.49M | let snd = second.as_ptr(); | 57 | | | 58 | 6.49M | snd as usize - fst as usize | 59 | 6.49M | } |
|
60 | | } |
61 | | |
62 | | impl<'a> Offset for &'a [u8] { |
63 | 0 | fn offset(&self, second: &Self) -> usize { |
64 | 0 | let fst = self.as_ptr(); |
65 | 0 | let snd = second.as_ptr(); |
66 | | |
67 | 0 | snd as usize - fst as usize |
68 | 0 | } Unexecuted instantiation: <&[u8] as nom::traits::Offset>::offset Unexecuted instantiation: <&[u8] as nom::traits::Offset>::offset |
69 | | } |
70 | | |
71 | | impl Offset for str { |
72 | 0 | fn offset(&self, second: &Self) -> usize { |
73 | 0 | let fst = self.as_ptr(); |
74 | 0 | let snd = second.as_ptr(); |
75 | | |
76 | 0 | snd as usize - fst as usize |
77 | 0 | } Unexecuted instantiation: <str as nom::traits::Offset>::offset Unexecuted instantiation: <str as nom::traits::Offset>::offset |
78 | | } |
79 | | |
80 | | impl<'a> Offset for &'a str { |
81 | 0 | fn offset(&self, second: &Self) -> usize { |
82 | 0 | let fst = self.as_ptr(); |
83 | 0 | let snd = second.as_ptr(); |
84 | | |
85 | 0 | snd as usize - fst as usize |
86 | 0 | } Unexecuted instantiation: <&str as nom::traits::Offset>::offset Unexecuted instantiation: <&str as nom::traits::Offset>::offset |
87 | | } |
88 | | |
89 | | /// Helper trait for types that can be viewed as a byte slice |
90 | | pub trait AsBytes { |
91 | | /// Casts the input type to a byte slice |
92 | | fn as_bytes(&self) -> &[u8]; |
93 | | } |
94 | | |
95 | | impl<'a> AsBytes for &'a str { |
96 | | #[inline(always)] |
97 | 38.2M | fn as_bytes(&self) -> &[u8] { |
98 | 38.2M | (*self).as_bytes() |
99 | 38.2M | } <&str as nom::traits::AsBytes>::as_bytes Line | Count | Source | 97 | 14.8M | fn as_bytes(&self) -> &[u8] { | 98 | 14.8M | (*self).as_bytes() | 99 | 14.8M | } |
<&str as nom::traits::AsBytes>::as_bytes Line | Count | Source | 97 | 23.3M | fn as_bytes(&self) -> &[u8] { | 98 | 23.3M | (*self).as_bytes() | 99 | 23.3M | } |
|
100 | | } |
101 | | |
102 | | impl AsBytes for str { |
103 | | #[inline(always)] |
104 | 71.2M | fn as_bytes(&self) -> &[u8] { |
105 | 71.2M | self.as_ref() |
106 | 71.2M | } <str as nom::traits::AsBytes>::as_bytes Line | Count | Source | 104 | 16.8M | fn as_bytes(&self) -> &[u8] { | 105 | 16.8M | self.as_ref() | 106 | 16.8M | } |
<str as nom::traits::AsBytes>::as_bytes Line | Count | Source | 104 | 54.4M | fn as_bytes(&self) -> &[u8] { | 105 | 54.4M | self.as_ref() | 106 | 54.4M | } |
|
107 | | } |
108 | | |
109 | | impl<'a> AsBytes for &'a [u8] { |
110 | | #[inline(always)] |
111 | 0 | fn as_bytes(&self) -> &[u8] { |
112 | 0 | *self |
113 | 0 | } Unexecuted instantiation: <&[u8] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <&[u8] as nom::traits::AsBytes>::as_bytes |
114 | | } |
115 | | |
116 | | impl AsBytes for [u8] { |
117 | | #[inline(always)] |
118 | 0 | fn as_bytes(&self) -> &[u8] { |
119 | 0 | self |
120 | 0 | } Unexecuted instantiation: <[u8] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <[u8] as nom::traits::AsBytes>::as_bytes |
121 | | } |
122 | | |
123 | | macro_rules! as_bytes_array_impls { |
124 | | ($($N:expr)+) => { |
125 | | $( |
126 | | impl<'a> AsBytes for &'a [u8; $N] { |
127 | | #[inline(always)] |
128 | 0 | fn as_bytes(&self) -> &[u8] { |
129 | 0 | *self |
130 | 0 | } Unexecuted instantiation: <&[u8; 3] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <&[u8; 4] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <&[u8; 5] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <&[u8; 6] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <&[u8; 7] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <&[u8; 21] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <&[u8; 22] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <&[u8; 23] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <&[u8; 24] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <&[u8; 25] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <&[u8; 26] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <&[u8; 27] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <&[u8; 28] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <&[u8; 29] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <&[u8; 30] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <&[u8; 31] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <&[u8; 32] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <&[u8; 8] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <&[u8; 9] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <&[u8; 10] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <&[u8; 11] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <&[u8; 12] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <&[u8; 13] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <&[u8; 14] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <&[u8; 15] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <&[u8; 16] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <&[u8; 17] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <&[u8; 18] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <&[u8; 19] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <&[u8; 20] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <&[u8; 0] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <&[u8; 1] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <&[u8; 2] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <&[u8; 3] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <&[u8; 4] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <&[u8; 5] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <&[u8; 6] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <&[u8; 7] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <&[u8; 21] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <&[u8; 22] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <&[u8; 23] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <&[u8; 24] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <&[u8; 25] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <&[u8; 26] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <&[u8; 27] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <&[u8; 28] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <&[u8; 29] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <&[u8; 30] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <&[u8; 31] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <&[u8; 32] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <&[u8; 8] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <&[u8; 9] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <&[u8; 10] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <&[u8; 11] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <&[u8; 12] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <&[u8; 13] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <&[u8; 14] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <&[u8; 15] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <&[u8; 16] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <&[u8; 17] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <&[u8; 18] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <&[u8; 19] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <&[u8; 20] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <&[u8; 0] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <&[u8; 1] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <&[u8; 2] as nom::traits::AsBytes>::as_bytes |
131 | | } |
132 | | |
133 | | impl AsBytes for [u8; $N] { |
134 | | #[inline(always)] |
135 | 0 | fn as_bytes(&self) -> &[u8] { |
136 | 0 | self |
137 | 0 | } Unexecuted instantiation: <[u8; 2] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <[u8; 3] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <[u8; 4] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <[u8; 5] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <[u8; 6] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <[u8; 20] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <[u8; 21] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <[u8; 22] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <[u8; 23] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <[u8; 24] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <[u8; 25] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <[u8; 26] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <[u8; 27] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <[u8; 28] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <[u8; 29] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <[u8; 30] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <[u8; 31] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <[u8; 32] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <[u8; 7] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <[u8; 8] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <[u8; 9] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <[u8; 10] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <[u8; 11] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <[u8; 12] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <[u8; 13] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <[u8; 14] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <[u8; 15] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <[u8; 16] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <[u8; 17] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <[u8; 18] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <[u8; 19] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <[u8; 0] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <[u8; 1] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <[u8; 2] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <[u8; 3] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <[u8; 4] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <[u8; 5] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <[u8; 6] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <[u8; 20] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <[u8; 21] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <[u8; 22] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <[u8; 23] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <[u8; 24] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <[u8; 25] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <[u8; 26] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <[u8; 27] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <[u8; 28] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <[u8; 29] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <[u8; 30] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <[u8; 31] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <[u8; 32] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <[u8; 7] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <[u8; 8] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <[u8; 9] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <[u8; 10] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <[u8; 11] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <[u8; 12] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <[u8; 13] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <[u8; 14] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <[u8; 15] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <[u8; 16] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <[u8; 17] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <[u8; 18] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <[u8; 19] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <[u8; 0] as nom::traits::AsBytes>::as_bytes Unexecuted instantiation: <[u8; 1] as nom::traits::AsBytes>::as_bytes |
138 | | } |
139 | | )+ |
140 | | }; |
141 | | } |
142 | | |
143 | | as_bytes_array_impls! { |
144 | | 0 1 2 3 4 5 6 7 8 9 |
145 | | 10 11 12 13 14 15 16 17 18 19 |
146 | | 20 21 22 23 24 25 26 27 28 29 |
147 | | 30 31 32 |
148 | | } |
149 | | |
150 | | /// Transforms common types to a char for basic token parsing |
151 | | pub trait AsChar { |
152 | | /// makes a char from self |
153 | | fn as_char(self) -> char; |
154 | | |
155 | | /// Tests that self is an alphabetic character |
156 | | /// |
157 | | /// Warning: for `&str` it recognizes alphabetic |
158 | | /// characters outside of the 52 ASCII letters |
159 | | fn is_alpha(self) -> bool; |
160 | | |
161 | | /// Tests that self is an alphabetic character |
162 | | /// or a decimal digit |
163 | | fn is_alphanum(self) -> bool; |
164 | | /// Tests that self is a decimal digit |
165 | | fn is_dec_digit(self) -> bool; |
166 | | /// Tests that self is an hex digit |
167 | | fn is_hex_digit(self) -> bool; |
168 | | /// Tests that self is an octal digit |
169 | | fn is_oct_digit(self) -> bool; |
170 | | /// Gets the len in bytes for self |
171 | | fn len(self) -> usize; |
172 | | } |
173 | | |
174 | | impl AsChar for u8 { |
175 | | #[inline] |
176 | 35.8M | fn as_char(self) -> char { |
177 | 35.8M | self as char |
178 | 35.8M | } <u8 as nom::traits::AsChar>::as_char Line | Count | Source | 176 | 33.4M | fn as_char(self) -> char { | 177 | 33.4M | self as char | 178 | 33.4M | } |
<u8 as nom::traits::AsChar>::as_char Line | Count | Source | 176 | 2.38M | fn as_char(self) -> char { | 177 | 2.38M | self as char | 178 | 2.38M | } |
|
179 | | #[inline] |
180 | 42.4k | fn is_alpha(self) -> bool { |
181 | 42.4k | (self >= 0x41 && self <= 0x5A) || (self >= 0x61 && self <= 0x7A) |
182 | 42.4k | } Unexecuted instantiation: <u8 as nom::traits::AsChar>::is_alpha <u8 as nom::traits::AsChar>::is_alpha Line | Count | Source | 180 | 42.4k | fn is_alpha(self) -> bool { | 181 | 42.4k | (self >= 0x41 && self <= 0x5A) || (self >= 0x61 && self <= 0x7A) | 182 | 42.4k | } |
|
183 | | #[inline] |
184 | 42.4k | fn is_alphanum(self) -> bool { |
185 | 42.4k | self.is_alpha() || self.is_dec_digit() |
186 | 42.4k | } Unexecuted instantiation: <u8 as nom::traits::AsChar>::is_alphanum <u8 as nom::traits::AsChar>::is_alphanum Line | Count | Source | 184 | 42.4k | fn is_alphanum(self) -> bool { | 185 | 42.4k | self.is_alpha() || self.is_dec_digit() | 186 | 42.4k | } |
|
187 | | #[inline] |
188 | 3.94M | fn is_dec_digit(self) -> bool { |
189 | 3.94M | self >= 0x30 && self <= 0x39 |
190 | 3.94M | } <u8 as nom::traits::AsChar>::is_dec_digit Line | Count | Source | 188 | 2.25M | fn is_dec_digit(self) -> bool { | 189 | 2.25M | self >= 0x30 && self <= 0x39 | 190 | 2.25M | } |
<u8 as nom::traits::AsChar>::is_dec_digit Line | Count | Source | 188 | 1.68M | fn is_dec_digit(self) -> bool { | 189 | 1.68M | self >= 0x30 && self <= 0x39 | 190 | 1.68M | } |
|
191 | | #[inline] |
192 | 0 | fn is_hex_digit(self) -> bool { |
193 | 0 | (self >= 0x30 && self <= 0x39) |
194 | 0 | || (self >= 0x41 && self <= 0x46) |
195 | 0 | || (self >= 0x61 && self <= 0x66) |
196 | 0 | } Unexecuted instantiation: <u8 as nom::traits::AsChar>::is_hex_digit Unexecuted instantiation: <u8 as nom::traits::AsChar>::is_hex_digit |
197 | | #[inline] |
198 | 0 | fn is_oct_digit(self) -> bool { |
199 | 0 | self >= 0x30 && self <= 0x37 |
200 | 0 | } Unexecuted instantiation: <u8 as nom::traits::AsChar>::is_oct_digit Unexecuted instantiation: <u8 as nom::traits::AsChar>::is_oct_digit |
201 | | #[inline] |
202 | 0 | fn len(self) -> usize { |
203 | 0 | 1 |
204 | 0 | } Unexecuted instantiation: <u8 as nom::traits::AsChar>::len Unexecuted instantiation: <u8 as nom::traits::AsChar>::len |
205 | | } |
206 | | impl<'a> AsChar for &'a u8 { |
207 | | #[inline] |
208 | 0 | fn as_char(self) -> char { |
209 | 0 | *self as char |
210 | 0 | } Unexecuted instantiation: <&u8 as nom::traits::AsChar>::as_char Unexecuted instantiation: <&u8 as nom::traits::AsChar>::as_char |
211 | | #[inline] |
212 | 0 | fn is_alpha(self) -> bool { |
213 | 0 | (*self >= 0x41 && *self <= 0x5A) || (*self >= 0x61 && *self <= 0x7A) |
214 | 0 | } Unexecuted instantiation: <&u8 as nom::traits::AsChar>::is_alpha Unexecuted instantiation: <&u8 as nom::traits::AsChar>::is_alpha |
215 | | #[inline] |
216 | 0 | fn is_alphanum(self) -> bool { |
217 | 0 | self.is_alpha() || self.is_dec_digit() |
218 | 0 | } Unexecuted instantiation: <&u8 as nom::traits::AsChar>::is_alphanum Unexecuted instantiation: <&u8 as nom::traits::AsChar>::is_alphanum |
219 | | #[inline] |
220 | 0 | fn is_dec_digit(self) -> bool { |
221 | 0 | *self >= 0x30 && *self <= 0x39 |
222 | 0 | } Unexecuted instantiation: <&u8 as nom::traits::AsChar>::is_dec_digit Unexecuted instantiation: <&u8 as nom::traits::AsChar>::is_dec_digit |
223 | | #[inline] |
224 | 0 | fn is_hex_digit(self) -> bool { |
225 | 0 | (*self >= 0x30 && *self <= 0x39) |
226 | 0 | || (*self >= 0x41 && *self <= 0x46) |
227 | 0 | || (*self >= 0x61 && *self <= 0x66) |
228 | 0 | } Unexecuted instantiation: <&u8 as nom::traits::AsChar>::is_hex_digit Unexecuted instantiation: <&u8 as nom::traits::AsChar>::is_hex_digit |
229 | | #[inline] |
230 | 0 | fn is_oct_digit(self) -> bool { |
231 | 0 | *self >= 0x30 && *self <= 0x37 |
232 | 0 | } Unexecuted instantiation: <&u8 as nom::traits::AsChar>::is_oct_digit Unexecuted instantiation: <&u8 as nom::traits::AsChar>::is_oct_digit |
233 | | #[inline] |
234 | 0 | fn len(self) -> usize { |
235 | 0 | 1 |
236 | 0 | } Unexecuted instantiation: <&u8 as nom::traits::AsChar>::len Unexecuted instantiation: <&u8 as nom::traits::AsChar>::len |
237 | | } |
238 | | |
239 | | impl AsChar for char { |
240 | | #[inline] |
241 | 739k | fn as_char(self) -> char { |
242 | 739k | self |
243 | 739k | } Unexecuted instantiation: <char as nom::traits::AsChar>::as_char <char as nom::traits::AsChar>::as_char Line | Count | Source | 241 | 739k | fn as_char(self) -> char { | 242 | 739k | self | 243 | 739k | } |
|
244 | | #[inline] |
245 | 48.3k | fn is_alpha(self) -> bool { |
246 | 48.3k | self.is_ascii_alphabetic() |
247 | 48.3k | } Unexecuted instantiation: <char as nom::traits::AsChar>::is_alpha <char as nom::traits::AsChar>::is_alpha Line | Count | Source | 245 | 48.3k | fn is_alpha(self) -> bool { | 246 | 48.3k | self.is_ascii_alphabetic() | 247 | 48.3k | } |
|
248 | | #[inline] |
249 | 0 | fn is_alphanum(self) -> bool { |
250 | 0 | self.is_alpha() || self.is_dec_digit() |
251 | 0 | } Unexecuted instantiation: <char as nom::traits::AsChar>::is_alphanum Unexecuted instantiation: <char as nom::traits::AsChar>::is_alphanum |
252 | | #[inline] |
253 | 783k | fn is_dec_digit(self) -> bool { |
254 | 783k | self.is_ascii_digit() |
255 | 783k | } Unexecuted instantiation: <char as nom::traits::AsChar>::is_dec_digit <char as nom::traits::AsChar>::is_dec_digit Line | Count | Source | 253 | 783k | fn is_dec_digit(self) -> bool { | 254 | 783k | self.is_ascii_digit() | 255 | 783k | } |
|
256 | | #[inline] |
257 | 0 | fn is_hex_digit(self) -> bool { |
258 | 0 | self.is_ascii_hexdigit() |
259 | 0 | } Unexecuted instantiation: <char as nom::traits::AsChar>::is_hex_digit Unexecuted instantiation: <char as nom::traits::AsChar>::is_hex_digit |
260 | | #[inline] |
261 | 0 | fn is_oct_digit(self) -> bool { |
262 | 0 | self.is_digit(8) |
263 | 0 | } Unexecuted instantiation: <char as nom::traits::AsChar>::is_oct_digit Unexecuted instantiation: <char as nom::traits::AsChar>::is_oct_digit |
264 | | #[inline] |
265 | 6 | fn len(self) -> usize { |
266 | 6 | self.len_utf8() |
267 | 6 | } Unexecuted instantiation: <char as nom::traits::AsChar>::len <char as nom::traits::AsChar>::len Line | Count | Source | 265 | 6 | fn len(self) -> usize { | 266 | 6 | self.len_utf8() | 267 | 6 | } |
|
268 | | } |
269 | | |
270 | | impl<'a> AsChar for &'a char { |
271 | | #[inline] |
272 | 1.87M | fn as_char(self) -> char { |
273 | 1.87M | *self |
274 | 1.87M | } <&char as nom::traits::AsChar>::as_char Line | Count | Source | 272 | 320k | fn as_char(self) -> char { | 273 | 320k | *self | 274 | 320k | } |
<&char as nom::traits::AsChar>::as_char Line | Count | Source | 272 | 1.55M | fn as_char(self) -> char { | 273 | 1.55M | *self | 274 | 1.55M | } |
|
275 | | #[inline] |
276 | 0 | fn is_alpha(self) -> bool { |
277 | 0 | self.is_ascii_alphabetic() |
278 | 0 | } Unexecuted instantiation: <&char as nom::traits::AsChar>::is_alpha Unexecuted instantiation: <&char as nom::traits::AsChar>::is_alpha |
279 | | #[inline] |
280 | 0 | fn is_alphanum(self) -> bool { |
281 | 0 | self.is_alpha() || self.is_dec_digit() |
282 | 0 | } Unexecuted instantiation: <&char as nom::traits::AsChar>::is_alphanum Unexecuted instantiation: <&char as nom::traits::AsChar>::is_alphanum |
283 | | #[inline] |
284 | 0 | fn is_dec_digit(self) -> bool { |
285 | 0 | self.is_ascii_digit() |
286 | 0 | } Unexecuted instantiation: <&char as nom::traits::AsChar>::is_dec_digit Unexecuted instantiation: <&char as nom::traits::AsChar>::is_dec_digit |
287 | | #[inline] |
288 | 0 | fn is_hex_digit(self) -> bool { |
289 | 0 | self.is_ascii_hexdigit() |
290 | 0 | } Unexecuted instantiation: <&char as nom::traits::AsChar>::is_hex_digit Unexecuted instantiation: <&char as nom::traits::AsChar>::is_hex_digit |
291 | | #[inline] |
292 | 0 | fn is_oct_digit(self) -> bool { |
293 | 0 | self.is_digit(8) |
294 | 0 | } Unexecuted instantiation: <&char as nom::traits::AsChar>::is_oct_digit Unexecuted instantiation: <&char as nom::traits::AsChar>::is_oct_digit |
295 | | #[inline] |
296 | 1.87M | fn len(self) -> usize { |
297 | 1.87M | self.len_utf8() |
298 | 1.87M | } <&char as nom::traits::AsChar>::len Line | Count | Source | 296 | 320k | fn len(self) -> usize { | 297 | 320k | self.len_utf8() | 298 | 320k | } |
<&char as nom::traits::AsChar>::len Line | Count | Source | 296 | 1.55M | fn len(self) -> usize { | 297 | 1.55M | self.len_utf8() | 298 | 1.55M | } |
|
299 | | } |
300 | | |
301 | | /// Abstracts common iteration operations on the input type |
302 | | pub trait InputIter { |
303 | | /// The current input type is a sequence of that `Item` type. |
304 | | /// |
305 | | /// Example: `u8` for `&[u8]` or `char` for `&str` |
306 | | type Item; |
307 | | /// An iterator over the input type, producing the item and its position |
308 | | /// for use with [Slice]. If we're iterating over `&str`, the position |
309 | | /// corresponds to the byte index of the character |
310 | | type Iter: Iterator<Item = (usize, Self::Item)>; |
311 | | |
312 | | /// An iterator over the input type, producing the item |
313 | | type IterElem: Iterator<Item = Self::Item>; |
314 | | |
315 | | /// Returns an iterator over the elements and their byte offsets |
316 | | fn iter_indices(&self) -> Self::Iter; |
317 | | /// Returns an iterator over the elements |
318 | | fn iter_elements(&self) -> Self::IterElem; |
319 | | /// Finds the byte position of the element |
320 | | fn position<P>(&self, predicate: P) -> Option<usize> |
321 | | where |
322 | | P: Fn(Self::Item) -> bool; |
323 | | /// Get the byte offset from the element's position in the stream |
324 | | fn slice_index(&self, count: usize) -> Result<usize, Needed>; |
325 | | } |
326 | | |
327 | | /// Abstracts slicing operations |
328 | | pub trait InputTake: Sized { |
329 | | /// Returns a slice of `count` bytes. panics if count > length |
330 | | fn take(&self, count: usize) -> Self; |
331 | | /// Split the stream at the `count` byte offset. panics if count > length |
332 | | fn take_split(&self, count: usize) -> (Self, Self); |
333 | | } |
334 | | |
335 | | impl<'a> InputIter for &'a [u8] { |
336 | | type Item = u8; |
337 | | type Iter = Enumerate<Self::IterElem>; |
338 | | type IterElem = Copied<Iter<'a, u8>>; |
339 | | |
340 | | #[inline] |
341 | 34.1M | fn iter_indices(&self) -> Self::Iter { |
342 | 34.1M | self.iter_elements().enumerate() |
343 | 34.1M | } <&[u8] as nom::traits::InputIter>::iter_indices Line | Count | Source | 341 | 21.6k | fn iter_indices(&self) -> Self::Iter { | 342 | 21.6k | self.iter_elements().enumerate() | 343 | 21.6k | } |
<&[u8] as nom::traits::InputIter>::iter_indices Line | Count | Source | 341 | 34.1M | fn iter_indices(&self) -> Self::Iter { | 342 | 34.1M | self.iter_elements().enumerate() | 343 | 34.1M | } |
|
344 | | #[inline] |
345 | 1.03G | fn iter_elements(&self) -> Self::IterElem { |
346 | 1.03G | self.iter().copied() |
347 | 1.03G | } <&[u8] as nom::traits::InputIter>::iter_elements Line | Count | Source | 345 | 356M | fn iter_elements(&self) -> Self::IterElem { | 346 | 356M | self.iter().copied() | 347 | 356M | } |
<&[u8] as nom::traits::InputIter>::iter_elements Line | Count | Source | 345 | 679M | fn iter_elements(&self) -> Self::IterElem { | 346 | 679M | self.iter().copied() | 347 | 679M | } |
|
348 | | #[inline] |
349 | 41.1M | fn position<P>(&self, predicate: P) -> Option<usize> |
350 | 41.1M | where |
351 | 41.1M | P: Fn(Self::Item) -> bool, |
352 | | { |
353 | 56.4M | self.iter().position(|b| predicate(*b)) Unexecuted instantiation: <&[u8] as nom::traits::InputIter>::position::<_>::{closure#0}<&[u8] as nom::traits::InputIter>::position::<nom::bytes::streaming::take_while_m_n<suricata::mqtt::parser::is_continuation_bit_set, &[u8], nom::error::Error<&[u8]>>::{closure#0}::{closure#0}>::{closure#0}Line | Count | Source | 353 | 56.4M | self.iter().position(|b| predicate(*b)) |
Unexecuted instantiation: <&[u8] as nom::traits::InputIter>::position::<_>::{closure#0} |
354 | 41.1M | } Unexecuted instantiation: <&[u8] as nom::traits::InputIter>::position::<_> <&[u8] as nom::traits::InputIter>::position::<nom::bytes::streaming::take_while_m_n<suricata::mqtt::parser::is_continuation_bit_set, &[u8], nom::error::Error<&[u8]>>::{closure#0}::{closure#0}>Line | Count | Source | 349 | 41.1M | fn position<P>(&self, predicate: P) -> Option<usize> | 350 | 41.1M | where | 351 | 41.1M | P: Fn(Self::Item) -> bool, | 352 | | { | 353 | 41.1M | self.iter().position(|b| predicate(*b)) | 354 | 41.1M | } |
Unexecuted instantiation: <&[u8] as nom::traits::InputIter>::position::<_> |
355 | | #[inline] |
356 | 175M | fn slice_index(&self, count: usize) -> Result<usize, Needed> { |
357 | 175M | if self.len() >= count { |
358 | 169M | Ok(count) |
359 | | } else { |
360 | 6.22M | Err(Needed::new(count - self.len())) |
361 | | } |
362 | 175M | } <&[u8] as nom::traits::InputIter>::slice_index Line | Count | Source | 356 | 49.4M | fn slice_index(&self, count: usize) -> Result<usize, Needed> { | 357 | 49.4M | if self.len() >= count { | 358 | 48.7M | Ok(count) | 359 | | } else { | 360 | 715k | Err(Needed::new(count - self.len())) | 361 | | } | 362 | 49.4M | } |
<&[u8] as nom::traits::InputIter>::slice_index Line | Count | Source | 356 | 125M | fn slice_index(&self, count: usize) -> Result<usize, Needed> { | 357 | 125M | if self.len() >= count { | 358 | 120M | Ok(count) | 359 | | } else { | 360 | 5.51M | Err(Needed::new(count - self.len())) | 361 | | } | 362 | 125M | } |
|
363 | | } |
364 | | |
365 | | impl<'a> InputTake for &'a [u8] { |
366 | | #[inline] |
367 | 0 | fn take(&self, count: usize) -> Self { |
368 | 0 | &self[0..count] |
369 | 0 | } Unexecuted instantiation: <&[u8] as nom::traits::InputTake>::take Unexecuted instantiation: <&[u8] as nom::traits::InputTake>::take |
370 | | #[inline] |
371 | 277M | fn take_split(&self, count: usize) -> (Self, Self) { |
372 | 277M | let (prefix, suffix) = self.split_at(count); |
373 | 277M | (suffix, prefix) |
374 | 277M | } <&[u8] as nom::traits::InputTake>::take_split Line | Count | Source | 371 | 69.3M | fn take_split(&self, count: usize) -> (Self, Self) { | 372 | 69.3M | let (prefix, suffix) = self.split_at(count); | 373 | 69.3M | (suffix, prefix) | 374 | 69.3M | } |
<&[u8] as nom::traits::InputTake>::take_split Line | Count | Source | 371 | 208M | fn take_split(&self, count: usize) -> (Self, Self) { | 372 | 208M | let (prefix, suffix) = self.split_at(count); | 373 | 208M | (suffix, prefix) | 374 | 208M | } |
|
375 | | } |
376 | | |
377 | | impl<'a> InputIter for &'a str { |
378 | | type Item = char; |
379 | | type Iter = CharIndices<'a>; |
380 | | type IterElem = Chars<'a>; |
381 | | #[inline] |
382 | 0 | fn iter_indices(&self) -> Self::Iter { |
383 | 0 | self.char_indices() |
384 | 0 | } Unexecuted instantiation: <&str as nom::traits::InputIter>::iter_indices Unexecuted instantiation: <&str as nom::traits::InputIter>::iter_indices |
385 | | #[inline] |
386 | 81.7k | fn iter_elements(&self) -> Self::IterElem { |
387 | 81.7k | self.chars() |
388 | 81.7k | } Unexecuted instantiation: <&str as nom::traits::InputIter>::iter_elements <&str as nom::traits::InputIter>::iter_elements Line | Count | Source | 386 | 81.7k | fn iter_elements(&self) -> Self::IterElem { | 387 | 81.7k | self.chars() | 388 | 81.7k | } |
|
389 | 0 | fn position<P>(&self, predicate: P) -> Option<usize> |
390 | 0 | where |
391 | 0 | P: Fn(Self::Item) -> bool, |
392 | | { |
393 | 0 | for (o, c) in self.char_indices() { |
394 | 0 | if predicate(c) { |
395 | 0 | return Some(o); |
396 | 0 | } |
397 | | } |
398 | 0 | None |
399 | 0 | } Unexecuted instantiation: <&str as nom::traits::InputIter>::position::<_> Unexecuted instantiation: <&str as nom::traits::InputIter>::position::<nom::character::complete::not_line_ending<&str, nom::error::Error<&str>>::{closure#0}>Unexecuted instantiation: <&str as nom::traits::InputIter>::position::<_> |
400 | | #[inline] |
401 | 0 | fn slice_index(&self, count: usize) -> Result<usize, Needed> { |
402 | 0 | let mut cnt = 0; |
403 | 0 | for (index, _) in self.char_indices() { |
404 | 0 | if cnt == count { |
405 | 0 | return Ok(index); |
406 | 0 | } |
407 | 0 | cnt += 1; |
408 | | } |
409 | 0 | if cnt == count { |
410 | 0 | return Ok(self.len()); |
411 | 0 | } |
412 | 0 | Err(Needed::Unknown) |
413 | 0 | } Unexecuted instantiation: <&str as nom::traits::InputIter>::slice_index Unexecuted instantiation: <&str as nom::traits::InputIter>::slice_index |
414 | | } |
415 | | |
416 | | impl<'a> InputTake for &'a str { |
417 | | #[inline] |
418 | 0 | fn take(&self, count: usize) -> Self { |
419 | 0 | &self[..count] |
420 | 0 | } Unexecuted instantiation: <&str as nom::traits::InputTake>::take Unexecuted instantiation: <&str as nom::traits::InputTake>::take |
421 | | |
422 | | // return byte index |
423 | | #[inline] |
424 | 243k | fn take_split(&self, count: usize) -> (Self, Self) { |
425 | 243k | let (prefix, suffix) = self.split_at(count); |
426 | 243k | (suffix, prefix) |
427 | 243k | } Unexecuted instantiation: <&str as nom::traits::InputTake>::take_split <&str as nom::traits::InputTake>::take_split Line | Count | Source | 424 | 243k | fn take_split(&self, count: usize) -> (Self, Self) { | 425 | 243k | let (prefix, suffix) = self.split_at(count); | 426 | 243k | (suffix, prefix) | 427 | 243k | } |
|
428 | | } |
429 | | |
430 | | /// Dummy trait used for default implementations (currently only used for `InputTakeAtPosition` and `Compare`). |
431 | | /// |
432 | | /// When implementing a custom input type, it is possible to use directly the |
433 | | /// default implementation: If the input type implements `InputLength`, `InputIter`, |
434 | | /// `InputTake` and `Clone`, you can implement `UnspecializedInput` and get |
435 | | /// a default version of `InputTakeAtPosition` and `Compare`. |
436 | | /// |
437 | | /// For performance reasons, you might want to write a custom implementation of |
438 | | /// `InputTakeAtPosition` (like the one for `&[u8]`). |
439 | | pub trait UnspecializedInput {} |
440 | | |
441 | | /// Methods to take as much input as possible until the provided function returns true for the current element. |
442 | | /// |
443 | | /// A large part of nom's basic parsers are built using this trait. |
444 | | pub trait InputTakeAtPosition: Sized { |
445 | | /// The current input type is a sequence of that `Item` type. |
446 | | /// |
447 | | /// Example: `u8` for `&[u8]` or `char` for `&str` |
448 | | type Item; |
449 | | |
450 | | /// Looks for the first element of the input type for which the condition returns true, |
451 | | /// and returns the input up to this position. |
452 | | /// |
453 | | /// *streaming version*: If no element is found matching the condition, this will return `Incomplete` |
454 | | fn split_at_position<P, E: ParseError<Self>>(&self, predicate: P) -> IResult<Self, Self, E> |
455 | | where |
456 | | P: Fn(Self::Item) -> bool; |
457 | | |
458 | | /// Looks for the first element of the input type for which the condition returns true |
459 | | /// and returns the input up to this position. |
460 | | /// |
461 | | /// Fails if the produced slice is empty. |
462 | | /// |
463 | | /// *streaming version*: If no element is found matching the condition, this will return `Incomplete` |
464 | | fn split_at_position1<P, E: ParseError<Self>>( |
465 | | &self, |
466 | | predicate: P, |
467 | | e: ErrorKind, |
468 | | ) -> IResult<Self, Self, E> |
469 | | where |
470 | | P: Fn(Self::Item) -> bool; |
471 | | |
472 | | /// Looks for the first element of the input type for which the condition returns true, |
473 | | /// and returns the input up to this position. |
474 | | /// |
475 | | /// *complete version*: If no element is found matching the condition, this will return the whole input |
476 | | fn split_at_position_complete<P, E: ParseError<Self>>( |
477 | | &self, |
478 | | predicate: P, |
479 | | ) -> IResult<Self, Self, E> |
480 | | where |
481 | | P: Fn(Self::Item) -> bool; |
482 | | |
483 | | /// Looks for the first element of the input type for which the condition returns true |
484 | | /// and returns the input up to this position. |
485 | | /// |
486 | | /// Fails if the produced slice is empty. |
487 | | /// |
488 | | /// *complete version*: If no element is found matching the condition, this will return the whole input |
489 | | fn split_at_position1_complete<P, E: ParseError<Self>>( |
490 | | &self, |
491 | | predicate: P, |
492 | | e: ErrorKind, |
493 | | ) -> IResult<Self, Self, E> |
494 | | where |
495 | | P: Fn(Self::Item) -> bool; |
496 | | } |
497 | | |
498 | | impl<T: InputLength + InputIter + InputTake + Clone + UnspecializedInput> InputTakeAtPosition |
499 | | for T |
500 | | { |
501 | | type Item = <T as InputIter>::Item; |
502 | | |
503 | 0 | fn split_at_position<P, E: ParseError<Self>>(&self, predicate: P) -> IResult<Self, Self, E> |
504 | 0 | where |
505 | 0 | P: Fn(Self::Item) -> bool, |
506 | | { |
507 | 0 | match self.position(predicate) { |
508 | 0 | Some(n) => Ok(self.take_split(n)), |
509 | 0 | None => Err(Err::Incomplete(Needed::new(1))), |
510 | | } |
511 | 0 | } Unexecuted instantiation: <_ as nom::traits::InputTakeAtPosition>::split_at_position::<_, _> Unexecuted instantiation: <_ as nom::traits::InputTakeAtPosition>::split_at_position::<_, _> |
512 | | |
513 | 0 | fn split_at_position1<P, E: ParseError<Self>>( |
514 | 0 | &self, |
515 | 0 | predicate: P, |
516 | 0 | e: ErrorKind, |
517 | 0 | ) -> IResult<Self, Self, E> |
518 | 0 | where |
519 | 0 | P: Fn(Self::Item) -> bool, |
520 | | { |
521 | 0 | match self.position(predicate) { |
522 | 0 | Some(0) => Err(Err::Error(E::from_error_kind(self.clone(), e))), |
523 | 0 | Some(n) => Ok(self.take_split(n)), |
524 | 0 | None => Err(Err::Incomplete(Needed::new(1))), |
525 | | } |
526 | 0 | } Unexecuted instantiation: <_ as nom::traits::InputTakeAtPosition>::split_at_position1::<_, _> Unexecuted instantiation: <_ as nom::traits::InputTakeAtPosition>::split_at_position1::<_, _> |
527 | | |
528 | 0 | fn split_at_position_complete<P, E: ParseError<Self>>( |
529 | 0 | &self, |
530 | 0 | predicate: P, |
531 | 0 | ) -> IResult<Self, Self, E> |
532 | 0 | where |
533 | 0 | P: Fn(Self::Item) -> bool, |
534 | | { |
535 | 0 | match self.split_at_position(predicate) { |
536 | 0 | Err(Err::Incomplete(_)) => Ok(self.take_split(self.input_len())), |
537 | 0 | res => res, |
538 | | } |
539 | 0 | } Unexecuted instantiation: <_ as nom::traits::InputTakeAtPosition>::split_at_position_complete::<_, _> Unexecuted instantiation: <_ as nom::traits::InputTakeAtPosition>::split_at_position_complete::<_, _> |
540 | | |
541 | 0 | fn split_at_position1_complete<P, E: ParseError<Self>>( |
542 | 0 | &self, |
543 | 0 | predicate: P, |
544 | 0 | e: ErrorKind, |
545 | 0 | ) -> IResult<Self, Self, E> |
546 | 0 | where |
547 | 0 | P: Fn(Self::Item) -> bool, |
548 | | { |
549 | 0 | match self.split_at_position1(predicate, e) { |
550 | | Err(Err::Incomplete(_)) => { |
551 | 0 | if self.input_len() == 0 { |
552 | 0 | Err(Err::Error(E::from_error_kind(self.clone(), e))) |
553 | | } else { |
554 | 0 | Ok(self.take_split(self.input_len())) |
555 | | } |
556 | | } |
557 | 0 | res => res, |
558 | | } |
559 | 0 | } Unexecuted instantiation: <_ as nom::traits::InputTakeAtPosition>::split_at_position1_complete::<_, _> Unexecuted instantiation: <_ as nom::traits::InputTakeAtPosition>::split_at_position1_complete::<_, _> |
560 | | } |
561 | | |
562 | | impl<'a> InputTakeAtPosition for &'a [u8] { |
563 | | type Item = u8; |
564 | | |
565 | 13.4M | fn split_at_position<P, E: ParseError<Self>>(&self, predicate: P) -> IResult<Self, Self, E> |
566 | 13.4M | where |
567 | 13.4M | P: Fn(Self::Item) -> bool, |
568 | | { |
569 | 99.8M | match self.iter().position(|c| predicate(*c)) {<&[u8] as nom::traits::InputTakeAtPosition>::split_at_position::<nom::bytes::streaming::take_while<suricata::http2::range::http2_parse_content_range::{closure#0}, &[u8], nom::error::Error<&[u8]>>::{closure#0}::{closure#0}, nom::error::Error<&[u8]>>::{closure#0}Line | Count | Source | 569 | 144k | match self.iter().position(|c| predicate(*c)) { |
<&[u8] as nom::traits::InputTakeAtPosition>::split_at_position::<nom::bytes::streaming::take_while<suricata::http2::range::http2_parse_content_range::{closure#2}, &[u8], nom::error::Error<&[u8]>>::{closure#0}::{closure#0}, nom::error::Error<&[u8]>>::{closure#0}Line | Count | Source | 569 | 239k | match self.iter().position(|c| predicate(*c)) { |
<&[u8] as nom::traits::InputTakeAtPosition>::split_at_position::<nom::bytes::streaming::take_while<suricata::http2::parser::http2_parse_var_uint::{closure#0}, &[u8], nom::error::Error<&[u8]>>::{closure#0}::{closure#0}, nom::error::Error<&[u8]>>::{closure#0}Line | Count | Source | 569 | 7.05M | match self.iter().position(|c| predicate(*c)) { |
<&[u8] as nom::traits::InputTakeAtPosition>::split_at_position::<nom::bytes::streaming::take_till<suricata::http2::range::http2_parse_content_range::{closure#1}, &[u8], nom::error::Error<&[u8]>>::{closure#0}::{closure#0}, nom::error::Error<&[u8]>>::{closure#0}Line | Count | Source | 569 | 2.02M | match self.iter().position(|c| predicate(*c)) { |
Unexecuted instantiation: <&[u8] as nom::traits::InputTakeAtPosition>::split_at_position::<_, _>::{closure#0}<&[u8] as nom::traits::InputTakeAtPosition>::split_at_position::<nom::bytes::streaming::take_while<suricata::mime::mime_parse_header_token::{closure#0}, &[u8], nom::error::Error<&[u8]>>::{closure#0}::{closure#0}, nom::error::Error<&[u8]>>::{closure#0}Line | Count | Source | 569 | 7.69M | match self.iter().position(|c| predicate(*c)) { |
<&[u8] as nom::traits::InputTakeAtPosition>::split_at_position::<nom::bytes::streaming::take_while<suricata::tftp::tftp::getstr::{closure#0}, &[u8], nom::error::Error<&[u8]>>::{closure#0}::{closure#0}, nom::error::Error<&[u8]>>::{closure#0}Line | Count | Source | 569 | 8.78M | match self.iter().position(|c| predicate(*c)) { |
<&[u8] as nom::traits::InputTakeAtPosition>::split_at_position::<nom::bytes::streaming::take_while<suricata::http2::range::http2_parse_content_range::{closure#0}, &[u8], nom::error::Error<&[u8]>>::{closure#0}::{closure#0}, nom::error::Error<&[u8]>>::{closure#0}Line | Count | Source | 569 | 51.5k | match self.iter().position(|c| predicate(*c)) { |
<&[u8] as nom::traits::InputTakeAtPosition>::split_at_position::<nom::bytes::streaming::take_while<suricata::http2::range::http2_parse_content_range::{closure#2}, &[u8], nom::error::Error<&[u8]>>::{closure#0}::{closure#0}, nom::error::Error<&[u8]>>::{closure#0}Line | Count | Source | 569 | 71.5k | match self.iter().position(|c| predicate(*c)) { |
<&[u8] as nom::traits::InputTakeAtPosition>::split_at_position::<nom::bytes::streaming::take_while<suricata::http2::parser::http2_parse_var_uint::{closure#0}, &[u8], nom::error::Error<&[u8]>>::{closure#0}::{closure#0}, nom::error::Error<&[u8]>>::{closure#0}Line | Count | Source | 569 | 4.88M | match self.iter().position(|c| predicate(*c)) { |
<&[u8] as nom::traits::InputTakeAtPosition>::split_at_position::<nom::bytes::streaming::take_while<nom::character::is_space, &[u8], nom::error::Error<&[u8]>>::{closure#0}::{closure#0}, nom::error::Error<&[u8]>>::{closure#0}Line | Count | Source | 569 | 3.52M | match self.iter().position(|c| predicate(*c)) { |
<&[u8] as nom::traits::InputTakeAtPosition>::split_at_position::<nom::bytes::streaming::take_while<suricata::sip::parser::is_header_name, &[u8], nom::error::Error<&[u8]>>::{closure#0}::{closure#0}, nom::error::Error<&[u8]>>::{closure#0}Line | Count | Source | 569 | 20.1M | match self.iter().position(|c| predicate(*c)) { |
<&[u8] as nom::traits::InputTakeAtPosition>::split_at_position::<nom::bytes::streaming::take_while<suricata::sip::parser::is_method_char, &[u8], nom::error::Error<&[u8]>>::{closure#0}::{closure#0}, nom::error::Error<&[u8]>>::{closure#0}Line | Count | Source | 569 | 3.49M | match self.iter().position(|c| predicate(*c)) { |
<&[u8] as nom::traits::InputTakeAtPosition>::split_at_position::<nom::bytes::streaming::take_while<suricata::sip::parser::is_reason_phrase, &[u8], nom::error::Error<&[u8]>>::{closure#0}::{closure#0}, nom::error::Error<&[u8]>>::{closure#0}Line | Count | Source | 569 | 11.1M | match self.iter().position(|c| predicate(*c)) { |
<&[u8] as nom::traits::InputTakeAtPosition>::split_at_position::<nom::bytes::streaming::take_while<suricata::ssh::parser::is_not_lineend, &[u8], nom::error::Error<&[u8]>>::{closure#0}::{closure#0}, nom::error::Error<&[u8]>>::{closure#0}Line | Count | Source | 569 | 29.4M | match self.iter().position(|c| predicate(*c)) { |
<&[u8] as nom::traits::InputTakeAtPosition>::split_at_position::<nom::bytes::streaming::take_till<suricata::http2::range::http2_parse_content_range::{closure#1}, &[u8], nom::error::Error<&[u8]>>::{closure#0}::{closure#0}, nom::error::Error<&[u8]>>::{closure#0}Line | Count | Source | 569 | 1.09M | match self.iter().position(|c| predicate(*c)) { |
Unexecuted instantiation: <&[u8] as nom::traits::InputTakeAtPosition>::split_at_position::<_, _>::{closure#0} |
570 | 13.3M | Some(i) => Ok(self.take_split(i)), |
571 | 59.3k | None => Err(Err::Incomplete(Needed::new(1))), |
572 | | } |
573 | 13.4M | } <&[u8] as nom::traits::InputTakeAtPosition>::split_at_position::<nom::bytes::streaming::take_while<suricata::http2::range::http2_parse_content_range::{closure#0}, &[u8], nom::error::Error<&[u8]>>::{closure#0}::{closure#0}, nom::error::Error<&[u8]>>Line | Count | Source | 565 | 111k | fn split_at_position<P, E: ParseError<Self>>(&self, predicate: P) -> IResult<Self, Self, E> | 566 | 111k | where | 567 | 111k | P: Fn(Self::Item) -> bool, | 568 | | { | 569 | 111k | match self.iter().position(|c| predicate(*c)) { | 570 | 109k | Some(i) => Ok(self.take_split(i)), | 571 | 1.55k | None => Err(Err::Incomplete(Needed::new(1))), | 572 | | } | 573 | 111k | } |
<&[u8] as nom::traits::InputTakeAtPosition>::split_at_position::<nom::bytes::streaming::take_while<suricata::http2::range::http2_parse_content_range::{closure#2}, &[u8], nom::error::Error<&[u8]>>::{closure#0}::{closure#0}, nom::error::Error<&[u8]>>Line | Count | Source | 565 | 105k | fn split_at_position<P, E: ParseError<Self>>(&self, predicate: P) -> IResult<Self, Self, E> | 566 | 105k | where | 567 | 105k | P: Fn(Self::Item) -> bool, | 568 | | { | 569 | 105k | match self.iter().position(|c| predicate(*c)) { | 570 | 105k | Some(i) => Ok(self.take_split(i)), | 571 | 514 | None => Err(Err::Incomplete(Needed::new(1))), | 572 | | } | 573 | 105k | } |
<&[u8] as nom::traits::InputTakeAtPosition>::split_at_position::<nom::bytes::streaming::take_while<suricata::http2::parser::http2_parse_var_uint::{closure#0}, &[u8], nom::error::Error<&[u8]>>::{closure#0}::{closure#0}, nom::error::Error<&[u8]>>Line | Count | Source | 565 | 541k | fn split_at_position<P, E: ParseError<Self>>(&self, predicate: P) -> IResult<Self, Self, E> | 566 | 541k | where | 567 | 541k | P: Fn(Self::Item) -> bool, | 568 | | { | 569 | 541k | match self.iter().position(|c| predicate(*c)) { | 570 | 533k | Some(i) => Ok(self.take_split(i)), | 571 | 8.25k | None => Err(Err::Incomplete(Needed::new(1))), | 572 | | } | 573 | 541k | } |
<&[u8] as nom::traits::InputTakeAtPosition>::split_at_position::<nom::bytes::streaming::take_till<suricata::http2::range::http2_parse_content_range::{closure#1}, &[u8], nom::error::Error<&[u8]>>::{closure#0}::{closure#0}, nom::error::Error<&[u8]>>Line | Count | Source | 565 | 109k | fn split_at_position<P, E: ParseError<Self>>(&self, predicate: P) -> IResult<Self, Self, E> | 566 | 109k | where | 567 | 109k | P: Fn(Self::Item) -> bool, | 568 | | { | 569 | 109k | match self.iter().position(|c| predicate(*c)) { | 570 | 105k | Some(i) => Ok(self.take_split(i)), | 571 | 3.93k | None => Err(Err::Incomplete(Needed::new(1))), | 572 | | } | 573 | 109k | } |
Unexecuted instantiation: <&[u8] as nom::traits::InputTakeAtPosition>::split_at_position::<_, _> <&[u8] as nom::traits::InputTakeAtPosition>::split_at_position::<nom::bytes::streaming::take_while<suricata::mime::mime_parse_header_token::{closure#0}, &[u8], nom::error::Error<&[u8]>>::{closure#0}::{closure#0}, nom::error::Error<&[u8]>>Line | Count | Source | 565 | 7.65M | fn split_at_position<P, E: ParseError<Self>>(&self, predicate: P) -> IResult<Self, Self, E> | 566 | 7.65M | where | 567 | 7.65M | P: Fn(Self::Item) -> bool, | 568 | | { | 569 | 7.65M | match self.iter().position(|c| predicate(*c)) { | 570 | 7.65M | Some(i) => Ok(self.take_split(i)), | 571 | 3.31k | None => Err(Err::Incomplete(Needed::new(1))), | 572 | | } | 573 | 7.65M | } |
<&[u8] as nom::traits::InputTakeAtPosition>::split_at_position::<nom::bytes::streaming::take_while<suricata::tftp::tftp::getstr::{closure#0}, &[u8], nom::error::Error<&[u8]>>::{closure#0}::{closure#0}, nom::error::Error<&[u8]>>Line | Count | Source | 565 | 957k | fn split_at_position<P, E: ParseError<Self>>(&self, predicate: P) -> IResult<Self, Self, E> | 566 | 957k | where | 567 | 957k | P: Fn(Self::Item) -> bool, | 568 | | { | 569 | 957k | match self.iter().position(|c| predicate(*c)) { | 570 | 957k | Some(i) => Ok(self.take_split(i)), | 571 | 717 | None => Err(Err::Incomplete(Needed::new(1))), | 572 | | } | 573 | 957k | } |
<&[u8] as nom::traits::InputTakeAtPosition>::split_at_position::<nom::bytes::streaming::take_while<suricata::http2::range::http2_parse_content_range::{closure#0}, &[u8], nom::error::Error<&[u8]>>::{closure#0}::{closure#0}, nom::error::Error<&[u8]>>Line | Count | Source | 565 | 28.6k | fn split_at_position<P, E: ParseError<Self>>(&self, predicate: P) -> IResult<Self, Self, E> | 566 | 28.6k | where | 567 | 28.6k | P: Fn(Self::Item) -> bool, | 568 | | { | 569 | 28.6k | match self.iter().position(|c| predicate(*c)) { | 570 | 28.2k | Some(i) => Ok(self.take_split(i)), | 571 | 344 | None => Err(Err::Incomplete(Needed::new(1))), | 572 | | } | 573 | 28.6k | } |
<&[u8] as nom::traits::InputTakeAtPosition>::split_at_position::<nom::bytes::streaming::take_while<suricata::http2::range::http2_parse_content_range::{closure#2}, &[u8], nom::error::Error<&[u8]>>::{closure#0}::{closure#0}, nom::error::Error<&[u8]>>Line | Count | Source | 565 | 26.5k | fn split_at_position<P, E: ParseError<Self>>(&self, predicate: P) -> IResult<Self, Self, E> | 566 | 26.5k | where | 567 | 26.5k | P: Fn(Self::Item) -> bool, | 568 | | { | 569 | 26.5k | match self.iter().position(|c| predicate(*c)) { | 570 | 26.3k | Some(i) => Ok(self.take_split(i)), | 571 | 265 | None => Err(Err::Incomplete(Needed::new(1))), | 572 | | } | 573 | 26.5k | } |
<&[u8] as nom::traits::InputTakeAtPosition>::split_at_position::<nom::bytes::streaming::take_while<suricata::http2::parser::http2_parse_var_uint::{closure#0}, &[u8], nom::error::Error<&[u8]>>::{closure#0}::{closure#0}, nom::error::Error<&[u8]>>Line | Count | Source | 565 | 434k | fn split_at_position<P, E: ParseError<Self>>(&self, predicate: P) -> IResult<Self, Self, E> | 566 | 434k | where | 567 | 434k | P: Fn(Self::Item) -> bool, | 568 | | { | 569 | 434k | match self.iter().position(|c| predicate(*c)) { | 570 | 429k | Some(i) => Ok(self.take_split(i)), | 571 | 4.33k | None => Err(Err::Incomplete(Needed::new(1))), | 572 | | } | 573 | 434k | } |
<&[u8] as nom::traits::InputTakeAtPosition>::split_at_position::<nom::bytes::streaming::take_while<nom::character::is_space, &[u8], nom::error::Error<&[u8]>>::{closure#0}::{closure#0}, nom::error::Error<&[u8]>>Line | Count | Source | 565 | 2.12M | fn split_at_position<P, E: ParseError<Self>>(&self, predicate: P) -> IResult<Self, Self, E> | 566 | 2.12M | where | 567 | 2.12M | P: Fn(Self::Item) -> bool, | 568 | | { | 569 | 2.12M | match self.iter().position(|c| predicate(*c)) { | 570 | 2.12M | Some(i) => Ok(self.take_split(i)), | 571 | 108 | None => Err(Err::Incomplete(Needed::new(1))), | 572 | | } | 573 | 2.12M | } |
<&[u8] as nom::traits::InputTakeAtPosition>::split_at_position::<nom::bytes::streaming::take_while<suricata::sip::parser::is_header_name, &[u8], nom::error::Error<&[u8]>>::{closure#0}::{closure#0}, nom::error::Error<&[u8]>>Line | Count | Source | 565 | 1.06M | fn split_at_position<P, E: ParseError<Self>>(&self, predicate: P) -> IResult<Self, Self, E> | 566 | 1.06M | where | 567 | 1.06M | P: Fn(Self::Item) -> bool, | 568 | | { | 569 | 1.06M | match self.iter().position(|c| predicate(*c)) { | 570 | 1.06M | Some(i) => Ok(self.take_split(i)), | 571 | 297 | None => Err(Err::Incomplete(Needed::new(1))), | 572 | | } | 573 | 1.06M | } |
<&[u8] as nom::traits::InputTakeAtPosition>::split_at_position::<nom::bytes::streaming::take_while<suricata::sip::parser::is_method_char, &[u8], nom::error::Error<&[u8]>>::{closure#0}::{closure#0}, nom::error::Error<&[u8]>>Line | Count | Source | 565 | 78.8k | fn split_at_position<P, E: ParseError<Self>>(&self, predicate: P) -> IResult<Self, Self, E> | 566 | 78.8k | where | 567 | 78.8k | P: Fn(Self::Item) -> bool, | 568 | | { | 569 | 78.8k | match self.iter().position(|c| predicate(*c)) { | 570 | 78.8k | Some(i) => Ok(self.take_split(i)), | 571 | 35 | None => Err(Err::Incomplete(Needed::new(1))), | 572 | | } | 573 | 78.8k | } |
<&[u8] as nom::traits::InputTakeAtPosition>::split_at_position::<nom::bytes::streaming::take_while<suricata::sip::parser::is_reason_phrase, &[u8], nom::error::Error<&[u8]>>::{closure#0}::{closure#0}, nom::error::Error<&[u8]>>Line | Count | Source | 565 | 93.2k | fn split_at_position<P, E: ParseError<Self>>(&self, predicate: P) -> IResult<Self, Self, E> | 566 | 93.2k | where | 567 | 93.2k | P: Fn(Self::Item) -> bool, | 568 | | { | 569 | 93.2k | match self.iter().position(|c| predicate(*c)) { | 570 | 93.2k | Some(i) => Ok(self.take_split(i)), | 571 | 85 | None => Err(Err::Incomplete(Needed::new(1))), | 572 | | } | 573 | 93.2k | } |
<&[u8] as nom::traits::InputTakeAtPosition>::split_at_position::<nom::bytes::streaming::take_while<suricata::ssh::parser::is_not_lineend, &[u8], nom::error::Error<&[u8]>>::{closure#0}::{closure#0}, nom::error::Error<&[u8]>>Line | Count | Source | 565 | 48.5k | fn split_at_position<P, E: ParseError<Self>>(&self, predicate: P) -> IResult<Self, Self, E> | 566 | 48.5k | where | 567 | 48.5k | P: Fn(Self::Item) -> bool, | 568 | | { | 569 | 48.5k | match self.iter().position(|c| predicate(*c)) { | 570 | 14.6k | Some(i) => Ok(self.take_split(i)), | 571 | 33.9k | None => Err(Err::Incomplete(Needed::new(1))), | 572 | | } | 573 | 48.5k | } |
<&[u8] as nom::traits::InputTakeAtPosition>::split_at_position::<nom::bytes::streaming::take_till<suricata::http2::range::http2_parse_content_range::{closure#1}, &[u8], nom::error::Error<&[u8]>>::{closure#0}::{closure#0}, nom::error::Error<&[u8]>>Line | Count | Source | 565 | 28.2k | fn split_at_position<P, E: ParseError<Self>>(&self, predicate: P) -> IResult<Self, Self, E> | 566 | 28.2k | where | 567 | 28.2k | P: Fn(Self::Item) -> bool, | 568 | | { | 569 | 28.2k | match self.iter().position(|c| predicate(*c)) { | 570 | 26.5k | Some(i) => Ok(self.take_split(i)), | 571 | 1.67k | None => Err(Err::Incomplete(Needed::new(1))), | 572 | | } | 573 | 28.2k | } |
Unexecuted instantiation: <&[u8] as nom::traits::InputTakeAtPosition>::split_at_position::<_, _> |
574 | | |
575 | 435k | fn split_at_position1<P, E: ParseError<Self>>( |
576 | 435k | &self, |
577 | 435k | predicate: P, |
578 | 435k | e: ErrorKind, |
579 | 435k | ) -> IResult<Self, Self, E> |
580 | 435k | where |
581 | 435k | P: Fn(Self::Item) -> bool, |
582 | | { |
583 | 52.4M | match self.iter().position(|c| predicate(*c)) {Unexecuted instantiation: <&[u8] as nom::traits::InputTakeAtPosition>::split_at_position1::<_, _>::{closure#0}<&[u8] as nom::traits::InputTakeAtPosition>::split_at_position1::<nom::character::streaming::alphanumeric1<&[u8], nom::error::Error<&[u8]>>::{closure#0}, nom::error::Error<&[u8]>>::{closure#0}Line | Count | Source | 583 | 42.4k | match self.iter().position(|c| predicate(*c)) { |
<&[u8] as nom::traits::InputTakeAtPosition>::split_at_position1::<nom::bytes::streaming::take_while1<suricata::sip::parser::is_version_char, &[u8], nom::error::Error<&[u8]>>::{closure#0}::{closure#0}, nom::error::Error<&[u8]>>::{closure#0}Line | Count | Source | 583 | 5.47M | match self.iter().position(|c| predicate(*c)) { |
<&[u8] as nom::traits::InputTakeAtPosition>::split_at_position1::<nom::bytes::streaming::take_while1<suricata::sip::parser::is_reason_phrase, &[u8], nom::error::Error<&[u8]>>::{closure#0}::{closure#0}, nom::error::Error<&[u8]>>::{closure#0}Line | Count | Source | 583 | 14.1M | match self.iter().position(|c| predicate(*c)) { |
<&[u8] as nom::traits::InputTakeAtPosition>::split_at_position1::<nom::bytes::streaming::take_while1<suricata::sip::parser::is_request_uri_char, &[u8], nom::error::Error<&[u8]>>::{closure#0}::{closure#0}, nom::error::Error<&[u8]>>::{closure#0}Line | Count | Source | 583 | 10.2M | match self.iter().position(|c| predicate(*c)) { |
<&[u8] as nom::traits::InputTakeAtPosition>::split_at_position1::<nom::bytes::streaming::is_not<&str, &[u8], nom::error::Error<&[u8]>>::{closure#0}::{closure#0}, nom::error::Error<&[u8]>>::{closure#0}Line | Count | Source | 583 | 22.4M | match self.iter().position(|c| predicate(*c)) { |
Unexecuted instantiation: <&[u8] as nom::traits::InputTakeAtPosition>::split_at_position1::<_, _>::{closure#0} |
584 | 1.64k | Some(0) => Err(Err::Error(E::from_error_kind(self, e))), |
585 | 429k | Some(i) => Ok(self.take_split(i)), |
586 | 4.63k | None => Err(Err::Incomplete(Needed::new(1))), |
587 | | } |
588 | 435k | } Unexecuted instantiation: <&[u8] as nom::traits::InputTakeAtPosition>::split_at_position1::<_, _> <&[u8] as nom::traits::InputTakeAtPosition>::split_at_position1::<nom::character::streaming::alphanumeric1<&[u8], nom::error::Error<&[u8]>>::{closure#0}, nom::error::Error<&[u8]>>Line | Count | Source | 575 | 12.4k | fn split_at_position1<P, E: ParseError<Self>>( | 576 | 12.4k | &self, | 577 | 12.4k | predicate: P, | 578 | 12.4k | e: ErrorKind, | 579 | 12.4k | ) -> IResult<Self, Self, E> | 580 | 12.4k | where | 581 | 12.4k | P: Fn(Self::Item) -> bool, | 582 | | { | 583 | 12.4k | match self.iter().position(|c| predicate(*c)) { | 584 | 18 | Some(0) => Err(Err::Error(E::from_error_kind(self, e))), | 585 | 11.0k | Some(i) => Ok(self.take_split(i)), | 586 | 1.37k | None => Err(Err::Incomplete(Needed::new(1))), | 587 | | } | 588 | 12.4k | } |
<&[u8] as nom::traits::InputTakeAtPosition>::split_at_position1::<nom::bytes::streaming::take_while1<suricata::sip::parser::is_version_char, &[u8], nom::error::Error<&[u8]>>::{closure#0}::{closure#0}, nom::error::Error<&[u8]>>Line | Count | Source | 575 | 170k | fn split_at_position1<P, E: ParseError<Self>>( | 576 | 170k | &self, | 577 | 170k | predicate: P, | 578 | 170k | e: ErrorKind, | 579 | 170k | ) -> IResult<Self, Self, E> | 580 | 170k | where | 581 | 170k | P: Fn(Self::Item) -> bool, | 582 | | { | 583 | 170k | match self.iter().position(|c| predicate(*c)) { | 584 | 51 | Some(0) => Err(Err::Error(E::from_error_kind(self, e))), | 585 | 170k | Some(i) => Ok(self.take_split(i)), | 586 | 28 | None => Err(Err::Incomplete(Needed::new(1))), | 587 | | } | 588 | 170k | } |
<&[u8] as nom::traits::InputTakeAtPosition>::split_at_position1::<nom::bytes::streaming::take_while1<suricata::sip::parser::is_reason_phrase, &[u8], nom::error::Error<&[u8]>>::{closure#0}::{closure#0}, nom::error::Error<&[u8]>>Line | Count | Source | 575 | 166k | fn split_at_position1<P, E: ParseError<Self>>( | 576 | 166k | &self, | 577 | 166k | predicate: P, | 578 | 166k | e: ErrorKind, | 579 | 166k | ) -> IResult<Self, Self, E> | 580 | 166k | where | 581 | 166k | P: Fn(Self::Item) -> bool, | 582 | | { | 583 | 166k | match self.iter().position(|c| predicate(*c)) { | 584 | 0 | Some(0) => Err(Err::Error(E::from_error_kind(self, e))), | 585 | 166k | Some(i) => Ok(self.take_split(i)), | 586 | 0 | None => Err(Err::Incomplete(Needed::new(1))), | 587 | | } | 588 | 166k | } |
<&[u8] as nom::traits::InputTakeAtPosition>::split_at_position1::<nom::bytes::streaming::take_while1<suricata::sip::parser::is_request_uri_char, &[u8], nom::error::Error<&[u8]>>::{closure#0}::{closure#0}, nom::error::Error<&[u8]>>Line | Count | Source | 575 | 78.7k | fn split_at_position1<P, E: ParseError<Self>>( | 576 | 78.7k | &self, | 577 | 78.7k | predicate: P, | 578 | 78.7k | e: ErrorKind, | 579 | 78.7k | ) -> IResult<Self, Self, E> | 580 | 78.7k | where | 581 | 78.7k | P: Fn(Self::Item) -> bool, | 582 | | { | 583 | 78.7k | match self.iter().position(|c| predicate(*c)) { | 584 | 1.53k | Some(0) => Err(Err::Error(E::from_error_kind(self, e))), | 585 | 77.0k | Some(i) => Ok(self.take_split(i)), | 586 | 130 | None => Err(Err::Incomplete(Needed::new(1))), | 587 | | } | 588 | 78.7k | } |
<&[u8] as nom::traits::InputTakeAtPosition>::split_at_position1::<nom::bytes::streaming::is_not<&str, &[u8], nom::error::Error<&[u8]>>::{closure#0}::{closure#0}, nom::error::Error<&[u8]>>Line | Count | Source | 575 | 7.14k | fn split_at_position1<P, E: ParseError<Self>>( | 576 | 7.14k | &self, | 577 | 7.14k | predicate: P, | 578 | 7.14k | e: ErrorKind, | 579 | 7.14k | ) -> IResult<Self, Self, E> | 580 | 7.14k | where | 581 | 7.14k | P: Fn(Self::Item) -> bool, | 582 | | { | 583 | 7.14k | match self.iter().position(|c| predicate(*c)) { | 584 | 39 | Some(0) => Err(Err::Error(E::from_error_kind(self, e))), | 585 | 3.99k | Some(i) => Ok(self.take_split(i)), | 586 | 3.10k | None => Err(Err::Incomplete(Needed::new(1))), | 587 | | } | 588 | 7.14k | } |
Unexecuted instantiation: <&[u8] as nom::traits::InputTakeAtPosition>::split_at_position1::<_, _> |
589 | | |
590 | 175k | fn split_at_position_complete<P, E: ParseError<Self>>( |
591 | 175k | &self, |
592 | 175k | predicate: P, |
593 | 175k | ) -> IResult<Self, Self, E> |
594 | 175k | where |
595 | 175k | P: Fn(Self::Item) -> bool, |
596 | | { |
597 | 366k | match self.iter().position(|c| predicate(*c)) {Unexecuted instantiation: <&[u8] as nom::traits::InputTakeAtPosition>::split_at_position_complete::<_, _>::{closure#0}<&[u8] as nom::traits::InputTakeAtPosition>::split_at_position_complete::<nom::character::complete::multispace0<&[u8], nom::error::Error<&[u8]>>::{closure#0}, nom::error::Error<&[u8]>>::{closure#0}Line | Count | Source | 597 | 366k | match self.iter().position(|c| predicate(*c)) { |
Unexecuted instantiation: <&[u8] as nom::traits::InputTakeAtPosition>::split_at_position_complete::<_, _>::{closure#0} |
598 | 164k | Some(i) => Ok(self.take_split(i)), |
599 | 11.2k | None => Ok(self.take_split(self.input_len())), |
600 | | } |
601 | 175k | } Unexecuted instantiation: <&[u8] as nom::traits::InputTakeAtPosition>::split_at_position_complete::<_, _> <&[u8] as nom::traits::InputTakeAtPosition>::split_at_position_complete::<nom::character::complete::multispace0<&[u8], nom::error::Error<&[u8]>>::{closure#0}, nom::error::Error<&[u8]>>Line | Count | Source | 590 | 175k | fn split_at_position_complete<P, E: ParseError<Self>>( | 591 | 175k | &self, | 592 | 175k | predicate: P, | 593 | 175k | ) -> IResult<Self, Self, E> | 594 | 175k | where | 595 | 175k | P: Fn(Self::Item) -> bool, | 596 | | { | 597 | 175k | match self.iter().position(|c| predicate(*c)) { | 598 | 164k | Some(i) => Ok(self.take_split(i)), | 599 | 11.2k | None => Ok(self.take_split(self.input_len())), | 600 | | } | 601 | 175k | } |
Unexecuted instantiation: <&[u8] as nom::traits::InputTakeAtPosition>::split_at_position_complete::<_, _> |
602 | | |
603 | 1.08M | fn split_at_position1_complete<P, E: ParseError<Self>>( |
604 | 1.08M | &self, |
605 | 1.08M | predicate: P, |
606 | 1.08M | e: ErrorKind, |
607 | 1.08M | ) -> IResult<Self, Self, E> |
608 | 1.08M | where |
609 | 1.08M | P: Fn(Self::Item) -> bool, |
610 | | { |
611 | 18.7M | match self.iter().position(|c| predicate(*c)) {<&[u8] as nom::traits::InputTakeAtPosition>::split_at_position1_complete::<nom::character::complete::digit1<&[u8], nom::error::Error<&[u8]>>::{closure#0}, nom::error::Error<&[u8]>>::{closure#0}Line | Count | Source | 611 | 2.25M | match self.iter().position(|c| predicate(*c)) { |
<&[u8] as nom::traits::InputTakeAtPosition>::split_at_position1_complete::<nom::bytes::complete::is_not<&str, &[u8], nom::error::Error<&[u8]>>::{closure#0}::{closure#0}, nom::error::Error<&[u8]>>::{closure#0}Line | Count | Source | 611 | 14.8M | match self.iter().position(|c| predicate(*c)) { |
Unexecuted instantiation: <&[u8] as nom::traits::InputTakeAtPosition>::split_at_position1_complete::<_, _>::{closure#0}<&[u8] as nom::traits::InputTakeAtPosition>::split_at_position1_complete::<nom::character::complete::digit1<&[u8], nom::error::Error<&[u8]>>::{closure#0}, nom::error::Error<&[u8]>>::{closure#0}Line | Count | Source | 611 | 1.67M | match self.iter().position(|c| predicate(*c)) { |
<&[u8] as nom::traits::InputTakeAtPosition>::split_at_position1_complete::<nom::bytes::complete::take_while1<nom::character::is_digit, &[u8], nom::error::Error<&[u8]>>::{closure#0}::{closure#0}, nom::error::Error<&[u8]>>::{closure#0}Line | Count | Source | 611 | 9.12k | match self.iter().position(|c| predicate(*c)) { |
Unexecuted instantiation: <&[u8] as nom::traits::InputTakeAtPosition>::split_at_position1_complete::<_, _>::{closure#0} |
612 | 23.7k | Some(0) => Err(Err::Error(E::from_error_kind(self, e))), |
613 | 1.00M | Some(i) => Ok(self.take_split(i)), |
614 | | None => { |
615 | 55.3k | if self.is_empty() { |
616 | 9.82k | Err(Err::Error(E::from_error_kind(self, e))) |
617 | | } else { |
618 | 45.4k | Ok(self.take_split(self.input_len())) |
619 | | } |
620 | | } |
621 | | } |
622 | 1.08M | } <&[u8] as nom::traits::InputTakeAtPosition>::split_at_position1_complete::<nom::character::complete::digit1<&[u8], nom::error::Error<&[u8]>>::{closure#0}, nom::error::Error<&[u8]>>Line | Count | Source | 603 | 295k | fn split_at_position1_complete<P, E: ParseError<Self>>( | 604 | 295k | &self, | 605 | 295k | predicate: P, | 606 | 295k | e: ErrorKind, | 607 | 295k | ) -> IResult<Self, Self, E> | 608 | 295k | where | 609 | 295k | P: Fn(Self::Item) -> bool, | 610 | | { | 611 | 295k | match self.iter().position(|c| predicate(*c)) { | 612 | 7.36k | Some(0) => Err(Err::Error(E::from_error_kind(self, e))), | 613 | 266k | Some(i) => Ok(self.take_split(i)), | 614 | | None => { | 615 | 20.9k | if self.is_empty() { | 616 | 826 | Err(Err::Error(E::from_error_kind(self, e))) | 617 | | } else { | 618 | 20.0k | Ok(self.take_split(self.input_len())) | 619 | | } | 620 | | } | 621 | | } | 622 | 295k | } |
<&[u8] as nom::traits::InputTakeAtPosition>::split_at_position1_complete::<nom::bytes::complete::is_not<&str, &[u8], nom::error::Error<&[u8]>>::{closure#0}::{closure#0}, nom::error::Error<&[u8]>>Line | Count | Source | 603 | 448k | fn split_at_position1_complete<P, E: ParseError<Self>>( | 604 | 448k | &self, | 605 | 448k | predicate: P, | 606 | 448k | e: ErrorKind, | 607 | 448k | ) -> IResult<Self, Self, E> | 608 | 448k | where | 609 | 448k | P: Fn(Self::Item) -> bool, | 610 | | { | 611 | 448k | match self.iter().position(|c| predicate(*c)) { | 612 | 193 | Some(0) => Err(Err::Error(E::from_error_kind(self, e))), | 613 | 447k | Some(i) => Ok(self.take_split(i)), | 614 | | None => { | 615 | 898 | if self.is_empty() { | 616 | 0 | Err(Err::Error(E::from_error_kind(self, e))) | 617 | | } else { | 618 | 898 | Ok(self.take_split(self.input_len())) | 619 | | } | 620 | | } | 621 | | } | 622 | 448k | } |
Unexecuted instantiation: <&[u8] as nom::traits::InputTakeAtPosition>::split_at_position1_complete::<_, _> <&[u8] as nom::traits::InputTakeAtPosition>::split_at_position1_complete::<nom::character::complete::digit1<&[u8], nom::error::Error<&[u8]>>::{closure#0}, nom::error::Error<&[u8]>>Line | Count | Source | 603 | 337k | fn split_at_position1_complete<P, E: ParseError<Self>>( | 604 | 337k | &self, | 605 | 337k | predicate: P, | 606 | 337k | e: ErrorKind, | 607 | 337k | ) -> IResult<Self, Self, E> | 608 | 337k | where | 609 | 337k | P: Fn(Self::Item) -> bool, | 610 | | { | 611 | 337k | match self.iter().position(|c| predicate(*c)) { | 612 | 14.8k | Some(0) => Err(Err::Error(E::from_error_kind(self, e))), | 613 | 289k | Some(i) => Ok(self.take_split(i)), | 614 | | None => { | 615 | 33.3k | if self.is_empty() { | 616 | 9.00k | Err(Err::Error(E::from_error_kind(self, e))) | 617 | | } else { | 618 | 24.3k | Ok(self.take_split(self.input_len())) | 619 | | } | 620 | | } | 621 | | } | 622 | 337k | } |
<&[u8] as nom::traits::InputTakeAtPosition>::split_at_position1_complete::<nom::bytes::complete::take_while1<nom::character::is_digit, &[u8], nom::error::Error<&[u8]>>::{closure#0}::{closure#0}, nom::error::Error<&[u8]>>Line | Count | Source | 603 | 3.94k | fn split_at_position1_complete<P, E: ParseError<Self>>( | 604 | 3.94k | &self, | 605 | 3.94k | predicate: P, | 606 | 3.94k | e: ErrorKind, | 607 | 3.94k | ) -> IResult<Self, Self, E> | 608 | 3.94k | where | 609 | 3.94k | P: Fn(Self::Item) -> bool, | 610 | | { | 611 | 3.94k | match self.iter().position(|c| predicate(*c)) { | 612 | 1.34k | Some(0) => Err(Err::Error(E::from_error_kind(self, e))), | 613 | 2.46k | Some(i) => Ok(self.take_split(i)), | 614 | | None => { | 615 | 134 | if self.is_empty() { | 616 | 0 | Err(Err::Error(E::from_error_kind(self, e))) | 617 | | } else { | 618 | 134 | Ok(self.take_split(self.input_len())) | 619 | | } | 620 | | } | 621 | | } | 622 | 3.94k | } |
Unexecuted instantiation: <&[u8] as nom::traits::InputTakeAtPosition>::split_at_position1_complete::<_, _> |
623 | | } |
624 | | |
625 | | impl<'a> InputTakeAtPosition for &'a str { |
626 | | type Item = char; |
627 | | |
628 | 0 | fn split_at_position<P, E: ParseError<Self>>(&self, predicate: P) -> IResult<Self, Self, E> |
629 | 0 | where |
630 | 0 | P: Fn(Self::Item) -> bool, |
631 | | { |
632 | 0 | match self.find(predicate) { |
633 | | // find() returns a byte index that is already in the slice at a char boundary |
634 | 0 | Some(i) => unsafe { Ok((self.get_unchecked(i..), self.get_unchecked(..i))) }, |
635 | 0 | None => Err(Err::Incomplete(Needed::new(1))), |
636 | | } |
637 | 0 | } Unexecuted instantiation: <&str as nom::traits::InputTakeAtPosition>::split_at_position::<_, _> Unexecuted instantiation: <&str as nom::traits::InputTakeAtPosition>::split_at_position::<_, _> |
638 | | |
639 | 18.9k | fn split_at_position1<P, E: ParseError<Self>>( |
640 | 18.9k | &self, |
641 | 18.9k | predicate: P, |
642 | 18.9k | e: ErrorKind, |
643 | 18.9k | ) -> IResult<Self, Self, E> |
644 | 18.9k | where |
645 | 18.9k | P: Fn(Self::Item) -> bool, |
646 | | { |
647 | 18.9k | match self.find(predicate) { |
648 | 9.54k | Some(0) => Err(Err::Error(E::from_error_kind(self, e))), |
649 | | // find() returns a byte index that is already in the slice at a char boundary |
650 | 2.35k | Some(i) => unsafe { Ok((self.get_unchecked(i..), self.get_unchecked(..i))) }, |
651 | 7.09k | None => Err(Err::Incomplete(Needed::new(1))), |
652 | | } |
653 | 18.9k | } Unexecuted instantiation: <&str as nom::traits::InputTakeAtPosition>::split_at_position1::<_, _> <&str as nom::traits::InputTakeAtPosition>::split_at_position1::<nom::bytes::streaming::is_a<&str, &str, nom::error::Error<&str>>::{closure#0}::{closure#0}, nom::error::Error<&str>>Line | Count | Source | 639 | 9.49k | fn split_at_position1<P, E: ParseError<Self>>( | 640 | 9.49k | &self, | 641 | 9.49k | predicate: P, | 642 | 9.49k | e: ErrorKind, | 643 | 9.49k | ) -> IResult<Self, Self, E> | 644 | 9.49k | where | 645 | 9.49k | P: Fn(Self::Item) -> bool, | 646 | | { | 647 | 9.49k | match self.find(predicate) { | 648 | 9.49k | Some(0) => Err(Err::Error(E::from_error_kind(self, e))), | 649 | | // find() returns a byte index that is already in the slice at a char boundary | 650 | 0 | Some(i) => unsafe { Ok((self.get_unchecked(i..), self.get_unchecked(..i))) }, | 651 | 0 | None => Err(Err::Incomplete(Needed::new(1))), | 652 | | } | 653 | 9.49k | } |
<&str as nom::traits::InputTakeAtPosition>::split_at_position1::<nom::bytes::streaming::is_not<&str, &str, nom::error::Error<&str>>::{closure#0}::{closure#0}, nom::error::Error<&str>>Line | Count | Source | 639 | 9.49k | fn split_at_position1<P, E: ParseError<Self>>( | 640 | 9.49k | &self, | 641 | 9.49k | predicate: P, | 642 | 9.49k | e: ErrorKind, | 643 | 9.49k | ) -> IResult<Self, Self, E> | 644 | 9.49k | where | 645 | 9.49k | P: Fn(Self::Item) -> bool, | 646 | | { | 647 | 9.49k | match self.find(predicate) { | 648 | 47 | Some(0) => Err(Err::Error(E::from_error_kind(self, e))), | 649 | | // find() returns a byte index that is already in the slice at a char boundary | 650 | 2.35k | Some(i) => unsafe { Ok((self.get_unchecked(i..), self.get_unchecked(..i))) }, | 651 | 7.09k | None => Err(Err::Incomplete(Needed::new(1))), | 652 | | } | 653 | 9.49k | } |
Unexecuted instantiation: <&str as nom::traits::InputTakeAtPosition>::split_at_position1::<_, _> |
654 | | |
655 | 765k | fn split_at_position_complete<P, E: ParseError<Self>>( |
656 | 765k | &self, |
657 | 765k | predicate: P, |
658 | 765k | ) -> IResult<Self, Self, E> |
659 | 765k | where |
660 | 765k | P: Fn(Self::Item) -> bool, |
661 | | { |
662 | 765k | match self.find(predicate) { |
663 | | // find() returns a byte index that is already in the slice at a char boundary |
664 | 603k | Some(i) => unsafe { Ok((self.get_unchecked(i..), self.get_unchecked(..i))) }, |
665 | | // the end of slice is a char boundary |
666 | | None => unsafe { |
667 | 162k | Ok(( |
668 | 162k | self.get_unchecked(self.len()..), |
669 | 162k | self.get_unchecked(..self.len()), |
670 | 162k | )) |
671 | | }, |
672 | | } |
673 | 765k | } Unexecuted instantiation: <&str as nom::traits::InputTakeAtPosition>::split_at_position_complete::<_, _> <&str as nom::traits::InputTakeAtPosition>::split_at_position_complete::<nom::character::complete::multispace0<&str, nom::error::Error<&str>>::{closure#0}, nom::error::Error<&str>>Line | Count | Source | 655 | 257k | fn split_at_position_complete<P, E: ParseError<Self>>( | 656 | 257k | &self, | 657 | 257k | predicate: P, | 658 | 257k | ) -> IResult<Self, Self, E> | 659 | 257k | where | 660 | 257k | P: Fn(Self::Item) -> bool, | 661 | | { | 662 | 257k | match self.find(predicate) { | 663 | | // find() returns a byte index that is already in the slice at a char boundary | 664 | 245k | Some(i) => unsafe { Ok((self.get_unchecked(i..), self.get_unchecked(..i))) }, | 665 | | // the end of slice is a char boundary | 666 | | None => unsafe { | 667 | 11.5k | Ok(( | 668 | 11.5k | self.get_unchecked(self.len()..), | 669 | 11.5k | self.get_unchecked(..self.len()), | 670 | 11.5k | )) | 671 | | }, | 672 | | } | 673 | 257k | } |
<&str as nom::traits::InputTakeAtPosition>::split_at_position_complete::<nom::character::complete::multispace0<&str, suricata::detect::error::RuleParseError<&str>>::{closure#0}, suricata::detect::error::RuleParseError<&str>>Line | Count | Source | 655 | 132k | fn split_at_position_complete<P, E: ParseError<Self>>( | 656 | 132k | &self, | 657 | 132k | predicate: P, | 658 | 132k | ) -> IResult<Self, Self, E> | 659 | 132k | where | 660 | 132k | P: Fn(Self::Item) -> bool, | 661 | | { | 662 | 132k | match self.find(predicate) { | 663 | | // find() returns a byte index that is already in the slice at a char boundary | 664 | 132k | Some(i) => unsafe { Ok((self.get_unchecked(i..), self.get_unchecked(..i))) }, | 665 | | // the end of slice is a char boundary | 666 | | None => unsafe { | 667 | 801 | Ok(( | 668 | 801 | self.get_unchecked(self.len()..), | 669 | 801 | self.get_unchecked(..self.len()), | 670 | 801 | )) | 671 | | }, | 672 | | } | 673 | 132k | } |
<&str as nom::traits::InputTakeAtPosition>::split_at_position_complete::<nom::character::complete::alpha0<&str, nom::error::Error<&str>>::{closure#0}, nom::error::Error<&str>>Line | Count | Source | 655 | 7.07k | fn split_at_position_complete<P, E: ParseError<Self>>( | 656 | 7.07k | &self, | 657 | 7.07k | predicate: P, | 658 | 7.07k | ) -> IResult<Self, Self, E> | 659 | 7.07k | where | 660 | 7.07k | P: Fn(Self::Item) -> bool, | 661 | | { | 662 | 7.07k | match self.find(predicate) { | 663 | | // find() returns a byte index that is already in the slice at a char boundary | 664 | 7.03k | Some(i) => unsafe { Ok((self.get_unchecked(i..), self.get_unchecked(..i))) }, | 665 | | // the end of slice is a char boundary | 666 | | None => unsafe { | 667 | 33 | Ok(( | 668 | 33 | self.get_unchecked(self.len()..), | 669 | 33 | self.get_unchecked(..self.len()), | 670 | 33 | )) | 671 | | }, | 672 | | } | 673 | 7.07k | } |
<&str as nom::traits::InputTakeAtPosition>::split_at_position_complete::<nom::bytes::complete::take_while<suricata::detect::uint::detect_parse_uint<u8>::{closure#0}, &str, nom::error::Error<&str>>::{closure#0}::{closure#0}, nom::error::Error<&str>>Line | Count | Source | 655 | 28.7k | fn split_at_position_complete<P, E: ParseError<Self>>( | 656 | 28.7k | &self, | 657 | 28.7k | predicate: P, | 658 | 28.7k | ) -> IResult<Self, Self, E> | 659 | 28.7k | where | 660 | 28.7k | P: Fn(Self::Item) -> bool, | 661 | | { | 662 | 28.7k | match self.find(predicate) { | 663 | | // find() returns a byte index that is already in the slice at a char boundary | 664 | 2.54k | Some(i) => unsafe { Ok((self.get_unchecked(i..), self.get_unchecked(..i))) }, | 665 | | // the end of slice is a char boundary | 666 | | None => unsafe { | 667 | 26.2k | Ok(( | 668 | 26.2k | self.get_unchecked(self.len()..), | 669 | 26.2k | self.get_unchecked(..self.len()), | 670 | 26.2k | )) | 671 | | }, | 672 | | } | 673 | 28.7k | } |
<&str as nom::traits::InputTakeAtPosition>::split_at_position_complete::<nom::bytes::complete::take_while<suricata::detect::uint::detect_parse_uint<u32>::{closure#0}, &str, nom::error::Error<&str>>::{closure#0}::{closure#0}, nom::error::Error<&str>>Line | Count | Source | 655 | 19.5k | fn split_at_position_complete<P, E: ParseError<Self>>( | 656 | 19.5k | &self, | 657 | 19.5k | predicate: P, | 658 | 19.5k | ) -> IResult<Self, Self, E> | 659 | 19.5k | where | 660 | 19.5k | P: Fn(Self::Item) -> bool, | 661 | | { | 662 | 19.5k | match self.find(predicate) { | 663 | | // find() returns a byte index that is already in the slice at a char boundary | 664 | 2.40k | Some(i) => unsafe { Ok((self.get_unchecked(i..), self.get_unchecked(..i))) }, | 665 | | // the end of slice is a char boundary | 666 | | None => unsafe { | 667 | 17.1k | Ok(( | 668 | 17.1k | self.get_unchecked(self.len()..), | 669 | 17.1k | self.get_unchecked(..self.len()), | 670 | 17.1k | )) | 671 | | }, | 672 | | } | 673 | 19.5k | } |
<&str as nom::traits::InputTakeAtPosition>::split_at_position_complete::<nom::bytes::complete::take_while<suricata::detect::uint::detect_parse_uint<u16>::{closure#0}, &str, nom::error::Error<&str>>::{closure#0}::{closure#0}, nom::error::Error<&str>>Line | Count | Source | 655 | 28.8k | fn split_at_position_complete<P, E: ParseError<Self>>( | 656 | 28.8k | &self, | 657 | 28.8k | predicate: P, | 658 | 28.8k | ) -> IResult<Self, Self, E> | 659 | 28.8k | where | 660 | 28.8k | P: Fn(Self::Item) -> bool, | 661 | | { | 662 | 28.8k | match self.find(predicate) { | 663 | | // find() returns a byte index that is already in the slice at a char boundary | 664 | 909 | Some(i) => unsafe { Ok((self.get_unchecked(i..), self.get_unchecked(..i))) }, | 665 | | // the end of slice is a char boundary | 666 | | None => unsafe { | 667 | 27.9k | Ok(( | 668 | 27.9k | self.get_unchecked(self.len()..), | 669 | 27.9k | self.get_unchecked(..self.len()), | 670 | 27.9k | )) | 671 | | }, | 672 | | } | 673 | 28.8k | } |
<&str as nom::traits::InputTakeAtPosition>::split_at_position_complete::<nom::bytes::complete::take_while<suricata::detect::uint::detect_parse_uint<u64>::{closure#0}, &str, nom::error::Error<&str>>::{closure#0}::{closure#0}, nom::error::Error<&str>>Line | Count | Source | 655 | 36.5k | fn split_at_position_complete<P, E: ParseError<Self>>( | 656 | 36.5k | &self, | 657 | 36.5k | predicate: P, | 658 | 36.5k | ) -> IResult<Self, Self, E> | 659 | 36.5k | where | 660 | 36.5k | P: Fn(Self::Item) -> bool, | 661 | | { | 662 | 36.5k | match self.find(predicate) { | 663 | | // find() returns a byte index that is already in the slice at a char boundary | 664 | 4.38k | Some(i) => unsafe { Ok((self.get_unchecked(i..), self.get_unchecked(..i))) }, | 665 | | // the end of slice is a char boundary | 666 | | None => unsafe { | 667 | 32.1k | Ok(( | 668 | 32.1k | self.get_unchecked(self.len()..), | 669 | 32.1k | self.get_unchecked(..self.len()), | 670 | 32.1k | )) | 671 | | }, | 672 | | } | 673 | 36.5k | } |
<&str as nom::traits::InputTakeAtPosition>::split_at_position_complete::<nom::bytes::complete::take_while<suricata::detect::uint::detect_parse_uint_inclusive<u32>::{closure#0}, &str, nom::error::Error<&str>>::{closure#0}::{closure#0}, nom::error::Error<&str>>Line | Count | Source | 655 | 19.6k | fn split_at_position_complete<P, E: ParseError<Self>>( | 656 | 19.6k | &self, | 657 | 19.6k | predicate: P, | 658 | 19.6k | ) -> IResult<Self, Self, E> | 659 | 19.6k | where | 660 | 19.6k | P: Fn(Self::Item) -> bool, | 661 | | { | 662 | 19.6k | match self.find(predicate) { | 663 | | // find() returns a byte index that is already in the slice at a char boundary | 664 | 4.24k | Some(i) => unsafe { Ok((self.get_unchecked(i..), self.get_unchecked(..i))) }, | 665 | | // the end of slice is a char boundary | 666 | | None => unsafe { | 667 | 15.3k | Ok(( | 668 | 15.3k | self.get_unchecked(self.len()..), | 669 | 15.3k | self.get_unchecked(..self.len()), | 670 | 15.3k | )) | 671 | | }, | 672 | | } | 673 | 19.6k | } |
<&str as nom::traits::InputTakeAtPosition>::split_at_position_complete::<nom::bytes::complete::take_while<suricata::krb::detect::detect_parse_encryption::{closure#0}, &str, nom::error::Error<&str>>::{closure#0}::{closure#0}, nom::error::Error<&str>>Line | Count | Source | 655 | 2.09k | fn split_at_position_complete<P, E: ParseError<Self>>( | 656 | 2.09k | &self, | 657 | 2.09k | predicate: P, | 658 | 2.09k | ) -> IResult<Self, Self, E> | 659 | 2.09k | where | 660 | 2.09k | P: Fn(Self::Item) -> bool, | 661 | | { | 662 | 2.09k | match self.find(predicate) { | 663 | | // find() returns a byte index that is already in the slice at a char boundary | 664 | 295 | Some(i) => unsafe { Ok((self.get_unchecked(i..), self.get_unchecked(..i))) }, | 665 | | // the end of slice is a char boundary | 666 | | None => unsafe { | 667 | 1.80k | Ok(( | 668 | 1.80k | self.get_unchecked(self.len()..), | 669 | 1.80k | self.get_unchecked(..self.len()), | 670 | 1.80k | )) | 671 | | }, | 672 | | } | 673 | 2.09k | } |
<&str as nom::traits::InputTakeAtPosition>::split_at_position_complete::<nom::bytes::complete::take_while<suricata::detect::stream_size::detect_parse_stream_size::{closure#1}, &str, nom::error::Error<&str>>::{closure#0}::{closure#0}, nom::error::Error<&str>>Line | Count | Source | 655 | 4.79k | fn split_at_position_complete<P, E: ParseError<Self>>( | 656 | 4.79k | &self, | 657 | 4.79k | predicate: P, | 658 | 4.79k | ) -> IResult<Self, Self, E> | 659 | 4.79k | where | 660 | 4.79k | P: Fn(Self::Item) -> bool, | 661 | | { | 662 | 4.79k | match self.find(predicate) { | 663 | | // find() returns a byte index that is already in the slice at a char boundary | 664 | 498 | Some(i) => unsafe { Ok((self.get_unchecked(i..), self.get_unchecked(..i))) }, | 665 | | // the end of slice is a char boundary | 666 | | None => unsafe { | 667 | 4.29k | Ok(( | 668 | 4.29k | self.get_unchecked(self.len()..), | 669 | 4.29k | self.get_unchecked(..self.len()), | 670 | 4.29k | )) | 671 | | }, | 672 | | } | 673 | 4.79k | } |
<&str as nom::traits::InputTakeAtPosition>::split_at_position_complete::<nom::bytes::complete::take_while<suricata::detect::requires::parse_key_value::{closure#0}, &str, nom::error::Error<&str>>::{closure#0}::{closure#0}, nom::error::Error<&str>>Line | Count | Source | 655 | 55.6k | fn split_at_position_complete<P, E: ParseError<Self>>( | 656 | 55.6k | &self, | 657 | 55.6k | predicate: P, | 658 | 55.6k | ) -> IResult<Self, Self, E> | 659 | 55.6k | where | 660 | 55.6k | P: Fn(Self::Item) -> bool, | 661 | | { | 662 | 55.6k | match self.find(predicate) { | 663 | | // find() returns a byte index that is already in the slice at a char boundary | 664 | 54.7k | Some(i) => unsafe { Ok((self.get_unchecked(i..), self.get_unchecked(..i))) }, | 665 | | // the end of slice is a char boundary | 666 | | None => unsafe { | 667 | 950 | Ok(( | 668 | 950 | self.get_unchecked(self.len()..), | 669 | 950 | self.get_unchecked(..self.len()), | 670 | 950 | )) | 671 | | }, | 672 | | } | 673 | 55.6k | } |
<&str as nom::traits::InputTakeAtPosition>::split_at_position_complete::<nom::bytes::complete::take_till<suricata::detect::requires::parse_key_value::{closure#1}, &str, nom::error::Error<&str>>::{closure#0}::{closure#0}, nom::error::Error<&str>>Line | Count | Source | 655 | 55.6k | fn split_at_position_complete<P, E: ParseError<Self>>( | 656 | 55.6k | &self, | 657 | 55.6k | predicate: P, | 658 | 55.6k | ) -> IResult<Self, Self, E> | 659 | 55.6k | where | 660 | 55.6k | P: Fn(Self::Item) -> bool, | 661 | | { | 662 | 55.6k | match self.find(predicate) { | 663 | | // find() returns a byte index that is already in the slice at a char boundary | 664 | 37.8k | Some(i) => unsafe { Ok((self.get_unchecked(i..), self.get_unchecked(..i))) }, | 665 | | // the end of slice is a char boundary | 666 | | None => unsafe { | 667 | 17.7k | Ok(( | 668 | 17.7k | self.get_unchecked(self.len()..), | 669 | 17.7k | self.get_unchecked(..self.len()), | 670 | 17.7k | )) | 671 | | }, | 672 | | } | 673 | 55.6k | } |
<&str as nom::traits::InputTakeAtPosition>::split_at_position_complete::<nom::bytes::complete::take_till<suricata::detect::requires::parse_next_version_part::{closure#0}, &str, nom::error::Error<&str>>::{closure#0}::{closure#0}, nom::error::Error<&str>>Line | Count | Source | 655 | 116k | fn split_at_position_complete<P, E: ParseError<Self>>( | 656 | 116k | &self, | 657 | 116k | predicate: P, | 658 | 116k | ) -> IResult<Self, Self, E> | 659 | 116k | where | 660 | 116k | P: Fn(Self::Item) -> bool, | 661 | | { | 662 | 116k | match self.find(predicate) { | 663 | | // find() returns a byte index that is already in the slice at a char boundary | 664 | 110k | Some(i) => unsafe { Ok((self.get_unchecked(i..), self.get_unchecked(..i))) }, | 665 | | // the end of slice is a char boundary | 666 | | None => unsafe { | 667 | 6.07k | Ok(( | 668 | 6.07k | self.get_unchecked(self.len()..), | 669 | 6.07k | self.get_unchecked(..self.len()), | 670 | 6.07k | )) | 671 | | }, | 672 | | } | 673 | 116k | } |
Unexecuted instantiation: <&str as nom::traits::InputTakeAtPosition>::split_at_position_complete::<_, _> |
674 | | |
675 | 1.08M | fn split_at_position1_complete<P, E: ParseError<Self>>( |
676 | 1.08M | &self, |
677 | 1.08M | predicate: P, |
678 | 1.08M | e: ErrorKind, |
679 | 1.08M | ) -> IResult<Self, Self, E> |
680 | 1.08M | where |
681 | 1.08M | P: Fn(Self::Item) -> bool, |
682 | | { |
683 | 1.08M | match self.find(predicate) { |
684 | 549k | Some(0) => Err(Err::Error(E::from_error_kind(self, e))), |
685 | | // find() returns a byte index that is already in the slice at a char boundary |
686 | 223k | Some(i) => unsafe { Ok((self.get_unchecked(i..), self.get_unchecked(..i))) }, |
687 | | None => { |
688 | 309k | if self.is_empty() { |
689 | 81.9k | Err(Err::Error(E::from_error_kind(self, e))) |
690 | | } else { |
691 | | // the end of slice is a char boundary |
692 | | unsafe { |
693 | 227k | Ok(( |
694 | 227k | self.get_unchecked(self.len()..), |
695 | 227k | self.get_unchecked(..self.len()), |
696 | 227k | )) |
697 | | } |
698 | | } |
699 | | } |
700 | | } |
701 | 1.08M | } Unexecuted instantiation: <&str as nom::traits::InputTakeAtPosition>::split_at_position1_complete::<_, _> <&str as nom::traits::InputTakeAtPosition>::split_at_position1_complete::<nom::character::complete::multispace1<&str, nom::error::Error<&str>>::{closure#0}, nom::error::Error<&str>>Line | Count | Source | 675 | 9.44k | fn split_at_position1_complete<P, E: ParseError<Self>>( | 676 | 9.44k | &self, | 677 | 9.44k | predicate: P, | 678 | 9.44k | e: ErrorKind, | 679 | 9.44k | ) -> IResult<Self, Self, E> | 680 | 9.44k | where | 681 | 9.44k | P: Fn(Self::Item) -> bool, | 682 | | { | 683 | 9.44k | match self.find(predicate) { | 684 | 2.38k | Some(0) => Err(Err::Error(E::from_error_kind(self, e))), | 685 | | // find() returns a byte index that is already in the slice at a char boundary | 686 | 5.70k | Some(i) => unsafe { Ok((self.get_unchecked(i..), self.get_unchecked(..i))) }, | 687 | | None => { | 688 | 1.35k | if self.is_empty() { | 689 | 1.04k | Err(Err::Error(E::from_error_kind(self, e))) | 690 | | } else { | 691 | | // the end of slice is a char boundary | 692 | | unsafe { | 693 | 305 | Ok(( | 694 | 305 | self.get_unchecked(self.len()..), | 695 | 305 | self.get_unchecked(..self.len()), | 696 | 305 | )) | 697 | | } | 698 | | } | 699 | | } | 700 | | } | 701 | 9.44k | } |
<&str as nom::traits::InputTakeAtPosition>::split_at_position1_complete::<nom::character::complete::digit1<&str, nom::error::Error<&str>>::{closure#0}, nom::error::Error<&str>>Line | Count | Source | 675 | 377k | fn split_at_position1_complete<P, E: ParseError<Self>>( | 676 | 377k | &self, | 677 | 377k | predicate: P, | 678 | 377k | e: ErrorKind, | 679 | 377k | ) -> IResult<Self, Self, E> | 680 | 377k | where | 681 | 377k | P: Fn(Self::Item) -> bool, | 682 | | { | 683 | 377k | match self.find(predicate) { | 684 | 127k | Some(0) => Err(Err::Error(E::from_error_kind(self, e))), | 685 | | // find() returns a byte index that is already in the slice at a char boundary | 686 | 52.3k | Some(i) => unsafe { Ok((self.get_unchecked(i..), self.get_unchecked(..i))) }, | 687 | | None => { | 688 | 197k | if self.is_empty() { | 689 | 8.74k | Err(Err::Error(E::from_error_kind(self, e))) | 690 | | } else { | 691 | | // the end of slice is a char boundary | 692 | | unsafe { | 693 | 188k | Ok(( | 694 | 188k | self.get_unchecked(self.len()..), | 695 | 188k | self.get_unchecked(..self.len()), | 696 | 188k | )) | 697 | | } | 698 | | } | 699 | | } | 700 | | } | 701 | 377k | } |
<&str as nom::traits::InputTakeAtPosition>::split_at_position1_complete::<nom::bytes::complete::take_while1<suricata::krb::detect::is_alphanumeric_or_dash, &str, nom::error::Error<&str>>::{closure#0}::{closure#0}, nom::error::Error<&str>>Line | Count | Source | 675 | 5.33k | fn split_at_position1_complete<P, E: ParseError<Self>>( | 676 | 5.33k | &self, | 677 | 5.33k | predicate: P, | 678 | 5.33k | e: ErrorKind, | 679 | 5.33k | ) -> IResult<Self, Self, E> | 680 | 5.33k | where | 681 | 5.33k | P: Fn(Self::Item) -> bool, | 682 | | { | 683 | 5.33k | match self.find(predicate) { | 684 | 26 | Some(0) => Err(Err::Error(E::from_error_kind(self, e))), | 685 | | // find() returns a byte index that is already in the slice at a char boundary | 686 | 2.47k | Some(i) => unsafe { Ok((self.get_unchecked(i..), self.get_unchecked(..i))) }, | 687 | | None => { | 688 | 2.82k | if self.is_empty() { | 689 | 1.29k | Err(Err::Error(E::from_error_kind(self, e))) | 690 | | } else { | 691 | | // the end of slice is a char boundary | 692 | | unsafe { | 693 | 1.52k | Ok(( | 694 | 1.52k | self.get_unchecked(self.len()..), | 695 | 1.52k | self.get_unchecked(..self.len()), | 696 | 1.52k | )) | 697 | | } | 698 | | } | 699 | | } | 700 | | } | 701 | 5.33k | } |
<&str as nom::traits::InputTakeAtPosition>::split_at_position1_complete::<nom::bytes::complete::is_a<&str, &str, nom::error::Error<&str>>::{closure#0}::{closure#0}, nom::error::Error<&str>>Line | Count | Source | 675 | 500k | fn split_at_position1_complete<P, E: ParseError<Self>>( | 676 | 500k | &self, | 677 | 500k | predicate: P, | 678 | 500k | e: ErrorKind, | 679 | 500k | ) -> IResult<Self, Self, E> | 680 | 500k | where | 681 | 500k | P: Fn(Self::Item) -> bool, | 682 | | { | 683 | 500k | match self.find(predicate) { | 684 | 417k | Some(0) => Err(Err::Error(E::from_error_kind(self, e))), | 685 | | // find() returns a byte index that is already in the slice at a char boundary | 686 | 12.5k | Some(i) => unsafe { Ok((self.get_unchecked(i..), self.get_unchecked(..i))) }, | 687 | | None => { | 688 | 70.0k | if self.is_empty() { | 689 | 70.0k | Err(Err::Error(E::from_error_kind(self, e))) | 690 | | } else { | 691 | | // the end of slice is a char boundary | 692 | | unsafe { | 693 | 0 | Ok(( | 694 | 0 | self.get_unchecked(self.len()..), | 695 | 0 | self.get_unchecked(..self.len()), | 696 | 0 | )) | 697 | | } | 698 | | } | 699 | | } | 700 | | } | 701 | 500k | } |
<&str as nom::traits::InputTakeAtPosition>::split_at_position1_complete::<nom::bytes::complete::is_not<&str, &str, suricata::detect::error::RuleParseError<&str>>::{closure#0}::{closure#0}, suricata::detect::error::RuleParseError<&str>>Line | Count | Source | 675 | 190k | fn split_at_position1_complete<P, E: ParseError<Self>>( | 676 | 190k | &self, | 677 | 190k | predicate: P, | 678 | 190k | e: ErrorKind, | 679 | 190k | ) -> IResult<Self, Self, E> | 680 | 190k | where | 681 | 190k | P: Fn(Self::Item) -> bool, | 682 | | { | 683 | 190k | match self.find(predicate) { | 684 | 1.82k | Some(0) => Err(Err::Error(E::from_error_kind(self, e))), | 685 | | // find() returns a byte index that is already in the slice at a char boundary | 686 | 150k | Some(i) => unsafe { Ok((self.get_unchecked(i..), self.get_unchecked(..i))) }, | 687 | | None => { | 688 | 37.3k | if self.is_empty() { | 689 | 801 | Err(Err::Error(E::from_error_kind(self, e))) | 690 | | } else { | 691 | | // the end of slice is a char boundary | 692 | | unsafe { | 693 | 36.5k | Ok(( | 694 | 36.5k | self.get_unchecked(self.len()..), | 695 | 36.5k | self.get_unchecked(..self.len()), | 696 | 36.5k | )) | 697 | | } | 698 | | } | 699 | | } | 700 | | } | 701 | 190k | } |
Unexecuted instantiation: <&str as nom::traits::InputTakeAtPosition>::split_at_position1_complete::<_, _> |
702 | | } |
703 | | |
704 | | /// Indicates whether a comparison was successful, an error, or |
705 | | /// if more data was needed |
706 | | #[derive(Debug, PartialEq)] |
707 | | pub enum CompareResult { |
708 | | /// Comparison was successful |
709 | | Ok, |
710 | | /// We need more data to be sure |
711 | | Incomplete, |
712 | | /// Comparison failed |
713 | | Error, |
714 | | } |
715 | | |
716 | | /// Abstracts comparison operations |
717 | | pub trait Compare<T> { |
718 | | /// Compares self to another value for equality |
719 | | fn compare(&self, t: T) -> CompareResult; |
720 | | /// Compares self to another value for equality |
721 | | /// independently of the case. |
722 | | /// |
723 | | /// Warning: for `&str`, the comparison is done |
724 | | /// by lowercasing both strings and comparing |
725 | | /// the result. This is a temporary solution until |
726 | | /// a better one appears |
727 | | fn compare_no_case(&self, t: T) -> CompareResult; |
728 | | } |
729 | | |
730 | 0 | fn lowercase_byte(c: u8) -> u8 { |
731 | 0 | match c { |
732 | 0 | b'A'..=b'Z' => c - b'A' + b'a', |
733 | 0 | _ => c, |
734 | | } |
735 | 0 | } Unexecuted instantiation: nom::traits::lowercase_byte Unexecuted instantiation: nom::traits::lowercase_byte |
736 | | |
737 | | impl<'a, 'b> Compare<&'b [u8]> for &'a [u8] { |
738 | | #[inline(always)] |
739 | 62.8M | fn compare(&self, t: &'b [u8]) -> CompareResult { |
740 | 96.0M | let pos = self.iter().zip(t.iter()).position(|(a, b)| a != b); <&[u8] as nom::traits::Compare<&[u8]>>::compare::{closure#0}Line | Count | Source | 740 | 67.7k | let pos = self.iter().zip(t.iter()).position(|(a, b)| a != b); |
Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8]>>::compare::{closure#0}Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8]>>::compare::{closure#0}<&[u8] as nom::traits::Compare<&[u8]>>::compare::{closure#0}Line | Count | Source | 740 | 33.5M | let pos = self.iter().zip(t.iter()).position(|(a, b)| a != b); |
<&[u8] as nom::traits::Compare<&[u8]>>::compare::{closure#0}Line | Count | Source | 740 | 62.4M | let pos = self.iter().zip(t.iter()).position(|(a, b)| a != b); |
Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8]>>::compare::{closure#0}Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8]>>::compare::{closure#0} |
741 | | |
742 | 62.8M | match pos { |
743 | 10.6M | Some(_) => CompareResult::Error, |
744 | | None => { |
745 | 52.1M | if self.len() >= t.len() { |
746 | 51.4M | CompareResult::Ok |
747 | | } else { |
748 | 759k | CompareResult::Incomplete |
749 | | } |
750 | | } |
751 | | } |
752 | | |
753 | | /* |
754 | | let len = self.len(); |
755 | | let blen = t.len(); |
756 | | let m = if len < blen { len } else { blen }; |
757 | | let reduced = &self[..m]; |
758 | | let b = &t[..m]; |
759 | | |
760 | | if reduced != b { |
761 | | CompareResult::Error |
762 | | } else if m < blen { |
763 | | CompareResult::Incomplete |
764 | | } else { |
765 | | CompareResult::Ok |
766 | | } |
767 | | */ |
768 | 62.8M | } <&[u8] as nom::traits::Compare<&[u8]>>::compare Line | Count | Source | 739 | 16.8M | fn compare(&self, t: &'b [u8]) -> CompareResult { | 740 | 16.8M | let pos = self.iter().zip(t.iter()).position(|(a, b)| a != b); | 741 | | | 742 | 16.8M | match pos { | 743 | 52.7k | Some(_) => CompareResult::Error, | 744 | | None => { | 745 | 16.7M | if self.len() >= t.len() { | 746 | 16.7M | CompareResult::Ok | 747 | | } else { | 748 | 5.29k | CompareResult::Incomplete | 749 | | } | 750 | | } | 751 | | } | 752 | | | 753 | | /* | 754 | | let len = self.len(); | 755 | | let blen = t.len(); | 756 | | let m = if len < blen { len } else { blen }; | 757 | | let reduced = &self[..m]; | 758 | | let b = &t[..m]; | 759 | | | 760 | | if reduced != b { | 761 | | CompareResult::Error | 762 | | } else if m < blen { | 763 | | CompareResult::Incomplete | 764 | | } else { | 765 | | CompareResult::Ok | 766 | | } | 767 | | */ | 768 | 16.8M | } |
<&[u8] as nom::traits::Compare<&[u8]>>::compare Line | Count | Source | 739 | 45.9M | fn compare(&self, t: &'b [u8]) -> CompareResult { | 740 | 45.9M | let pos = self.iter().zip(t.iter()).position(|(a, b)| a != b); | 741 | | | 742 | 45.9M | match pos { | 743 | 10.5M | Some(_) => CompareResult::Error, | 744 | | None => { | 745 | 35.4M | if self.len() >= t.len() { | 746 | 34.6M | CompareResult::Ok | 747 | | } else { | 748 | 754k | CompareResult::Incomplete | 749 | | } | 750 | | } | 751 | | } | 752 | | | 753 | | /* | 754 | | let len = self.len(); | 755 | | let blen = t.len(); | 756 | | let m = if len < blen { len } else { blen }; | 757 | | let reduced = &self[..m]; | 758 | | let b = &t[..m]; | 759 | | | 760 | | if reduced != b { | 761 | | CompareResult::Error | 762 | | } else if m < blen { | 763 | | CompareResult::Incomplete | 764 | | } else { | 765 | | CompareResult::Ok | 766 | | } | 767 | | */ | 768 | 45.9M | } |
|
769 | | |
770 | | #[inline(always)] |
771 | 0 | fn compare_no_case(&self, t: &'b [u8]) -> CompareResult { |
772 | 0 | if self |
773 | 0 | .iter() |
774 | 0 | .zip(t) |
775 | 0 | .any(|(a, b)| lowercase_byte(*a) != lowercase_byte(*b)) Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8]>>::compare_no_case::{closure#0}Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8]>>::compare_no_case::{closure#0} |
776 | | { |
777 | 0 | CompareResult::Error |
778 | 0 | } else if self.len() < t.len() { |
779 | 0 | CompareResult::Incomplete |
780 | | } else { |
781 | 0 | CompareResult::Ok |
782 | | } |
783 | 0 | } Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8]>>::compare_no_case |
784 | | } |
785 | | |
786 | | impl< |
787 | | T: InputLength + InputIter<Item = u8> + InputTake + UnspecializedInput, |
788 | | O: InputLength + InputIter<Item = u8> + InputTake, |
789 | | > Compare<O> for T |
790 | | { |
791 | | #[inline(always)] |
792 | 0 | fn compare(&self, t: O) -> CompareResult { |
793 | 0 | let pos = self |
794 | 0 | .iter_elements() |
795 | 0 | .zip(t.iter_elements()) |
796 | 0 | .position(|(a, b)| a != b); Unexecuted instantiation: <_ as nom::traits::Compare<_>>::compare::{closure#0}Unexecuted instantiation: <_ as nom::traits::Compare<_>>::compare::{closure#0} |
797 | | |
798 | 0 | match pos { |
799 | 0 | Some(_) => CompareResult::Error, |
800 | | None => { |
801 | 0 | if self.input_len() >= t.input_len() { |
802 | 0 | CompareResult::Ok |
803 | | } else { |
804 | 0 | CompareResult::Incomplete |
805 | | } |
806 | | } |
807 | | } |
808 | 0 | } Unexecuted instantiation: <_ as nom::traits::Compare<_>>::compare Unexecuted instantiation: <_ as nom::traits::Compare<_>>::compare |
809 | | |
810 | | #[inline(always)] |
811 | 0 | fn compare_no_case(&self, t: O) -> CompareResult { |
812 | 0 | if self |
813 | 0 | .iter_elements() |
814 | 0 | .zip(t.iter_elements()) |
815 | 0 | .any(|(a, b)| lowercase_byte(a) != lowercase_byte(b)) Unexecuted instantiation: <_ as nom::traits::Compare<_>>::compare_no_case::{closure#0}Unexecuted instantiation: <_ as nom::traits::Compare<_>>::compare_no_case::{closure#0} |
816 | | { |
817 | 0 | CompareResult::Error |
818 | 0 | } else if self.input_len() < t.input_len() { |
819 | 0 | CompareResult::Incomplete |
820 | | } else { |
821 | 0 | CompareResult::Ok |
822 | | } |
823 | 0 | } Unexecuted instantiation: <_ as nom::traits::Compare<_>>::compare_no_case Unexecuted instantiation: <_ as nom::traits::Compare<_>>::compare_no_case |
824 | | } |
825 | | |
826 | | impl<'a, 'b> Compare<&'b str> for &'a [u8] { |
827 | | #[inline(always)] |
828 | 50.2M | fn compare(&self, t: &'b str) -> CompareResult { |
829 | 50.2M | self.compare(AsBytes::as_bytes(t)) |
830 | 50.2M | } <&[u8] as nom::traits::Compare<&str>>::compare Line | Count | Source | 828 | 16.8M | fn compare(&self, t: &'b str) -> CompareResult { | 829 | 16.8M | self.compare(AsBytes::as_bytes(t)) | 830 | 16.8M | } |
<&[u8] as nom::traits::Compare<&str>>::compare Line | Count | Source | 828 | 33.4M | fn compare(&self, t: &'b str) -> CompareResult { | 829 | 33.4M | self.compare(AsBytes::as_bytes(t)) | 830 | 33.4M | } |
|
831 | | #[inline(always)] |
832 | 0 | fn compare_no_case(&self, t: &'b str) -> CompareResult { |
833 | 0 | self.compare_no_case(AsBytes::as_bytes(t)) |
834 | 0 | } Unexecuted instantiation: <&[u8] as nom::traits::Compare<&str>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<&str>>::compare_no_case |
835 | | } |
836 | | |
837 | | impl<'a, 'b> Compare<&'b str> for &'a str { |
838 | | #[inline(always)] |
839 | 920k | fn compare(&self, t: &'b str) -> CompareResult { |
840 | 920k | self.as_bytes().compare(t.as_bytes()) |
841 | 920k | } Unexecuted instantiation: <&str as nom::traits::Compare<&str>>::compare <&str as nom::traits::Compare<&str>>::compare Line | Count | Source | 839 | 920k | fn compare(&self, t: &'b str) -> CompareResult { | 840 | 920k | self.as_bytes().compare(t.as_bytes()) | 841 | 920k | } |
|
842 | | |
843 | | //FIXME: this version is too simple and does not use the current locale |
844 | | #[inline(always)] |
845 | 217k | fn compare_no_case(&self, t: &'b str) -> CompareResult { |
846 | 217k | let pos = self |
847 | 217k | .chars() |
848 | 217k | .zip(t.chars()) |
849 | 217k | .position(|(a, b)| a.to_lowercase().ne(b.to_lowercase())); Unexecuted instantiation: <&str as nom::traits::Compare<&str>>::compare_no_case::{closure#0}<&str as nom::traits::Compare<&str>>::compare_no_case::{closure#0}Line | Count | Source | 849 | 40.5k | .position(|(a, b)| a.to_lowercase().ne(b.to_lowercase())); |
Unexecuted instantiation: <&str as nom::traits::Compare<&str>>::compare_no_case::{closure#0} |
850 | | |
851 | 217k | match pos { |
852 | 36.6k | Some(_) => CompareResult::Error, |
853 | | None => { |
854 | 180k | if self.len() >= t.len() { |
855 | 1.74k | CompareResult::Ok |
856 | | } else { |
857 | 179k | CompareResult::Incomplete |
858 | | } |
859 | | } |
860 | | } |
861 | 217k | } Unexecuted instantiation: <&str as nom::traits::Compare<&str>>::compare_no_case <&str as nom::traits::Compare<&str>>::compare_no_case Line | Count | Source | 845 | 217k | fn compare_no_case(&self, t: &'b str) -> CompareResult { | 846 | 217k | let pos = self | 847 | 217k | .chars() | 848 | 217k | .zip(t.chars()) | 849 | 217k | .position(|(a, b)| a.to_lowercase().ne(b.to_lowercase())); | 850 | | | 851 | 217k | match pos { | 852 | 36.6k | Some(_) => CompareResult::Error, | 853 | | None => { | 854 | 180k | if self.len() >= t.len() { | 855 | 1.74k | CompareResult::Ok | 856 | | } else { | 857 | 179k | CompareResult::Incomplete | 858 | | } | 859 | | } | 860 | | } | 861 | 217k | } |
|
862 | | } |
863 | | |
864 | | impl<'a, 'b> Compare<&'b [u8]> for &'a str { |
865 | | #[inline(always)] |
866 | 0 | fn compare(&self, t: &'b [u8]) -> CompareResult { |
867 | 0 | AsBytes::as_bytes(self).compare(t) |
868 | 0 | } Unexecuted instantiation: <&str as nom::traits::Compare<&[u8]>>::compare Unexecuted instantiation: <&str as nom::traits::Compare<&[u8]>>::compare |
869 | | #[inline(always)] |
870 | 0 | fn compare_no_case(&self, t: &'b [u8]) -> CompareResult { |
871 | 0 | AsBytes::as_bytes(self).compare_no_case(t) |
872 | 0 | } Unexecuted instantiation: <&str as nom::traits::Compare<&[u8]>>::compare_no_case Unexecuted instantiation: <&str as nom::traits::Compare<&[u8]>>::compare_no_case |
873 | | } |
874 | | |
875 | | /// Look for a token in self |
876 | | pub trait FindToken<T> { |
877 | | /// Returns true if self contains the token |
878 | | fn find_token(&self, token: T) -> bool; |
879 | | } |
880 | | |
881 | | impl<'a> FindToken<u8> for &'a [u8] { |
882 | 37.3M | fn find_token(&self, token: u8) -> bool { |
883 | 37.3M | memchr::memchr(token, self).is_some() |
884 | 37.3M | } <&[u8] as nom::traits::FindToken<u8>>::find_token Line | Count | Source | 882 | 14.8M | fn find_token(&self, token: u8) -> bool { | 883 | 14.8M | memchr::memchr(token, self).is_some() | 884 | 14.8M | } |
<&[u8] as nom::traits::FindToken<u8>>::find_token Line | Count | Source | 882 | 22.4M | fn find_token(&self, token: u8) -> bool { | 883 | 22.4M | memchr::memchr(token, self).is_some() | 884 | 22.4M | } |
|
885 | | } |
886 | | |
887 | | impl<'a> FindToken<u8> for &'a str { |
888 | 37.3M | fn find_token(&self, token: u8) -> bool { |
889 | 37.3M | self.as_bytes().find_token(token) |
890 | 37.3M | } <&str as nom::traits::FindToken<u8>>::find_token Line | Count | Source | 888 | 14.8M | fn find_token(&self, token: u8) -> bool { | 889 | 14.8M | self.as_bytes().find_token(token) | 890 | 14.8M | } |
<&str as nom::traits::FindToken<u8>>::find_token Line | Count | Source | 888 | 22.4M | fn find_token(&self, token: u8) -> bool { | 889 | 22.4M | self.as_bytes().find_token(token) | 890 | 22.4M | } |
|
891 | | } |
892 | | |
893 | | impl<'a, 'b> FindToken<&'a u8> for &'b [u8] { |
894 | 0 | fn find_token(&self, token: &u8) -> bool { |
895 | 0 | self.find_token(*token) |
896 | 0 | } Unexecuted instantiation: <&[u8] as nom::traits::FindToken<&u8>>::find_token Unexecuted instantiation: <&[u8] as nom::traits::FindToken<&u8>>::find_token |
897 | | } |
898 | | |
899 | | impl<'a, 'b> FindToken<&'a u8> for &'b str { |
900 | 0 | fn find_token(&self, token: &u8) -> bool { |
901 | 0 | self.as_bytes().find_token(token) |
902 | 0 | } Unexecuted instantiation: <&str as nom::traits::FindToken<&u8>>::find_token Unexecuted instantiation: <&str as nom::traits::FindToken<&u8>>::find_token |
903 | | } |
904 | | |
905 | | impl<'a> FindToken<char> for &'a [u8] { |
906 | 0 | fn find_token(&self, token: char) -> bool { |
907 | 0 | self.iter().any(|i| *i == token as u8) Unexecuted instantiation: <&[u8] as nom::traits::FindToken<char>>::find_token::{closure#0}Unexecuted instantiation: <&[u8] as nom::traits::FindToken<char>>::find_token::{closure#0} |
908 | 0 | } Unexecuted instantiation: <&[u8] as nom::traits::FindToken<char>>::find_token Unexecuted instantiation: <&[u8] as nom::traits::FindToken<char>>::find_token |
909 | | } |
910 | | |
911 | | impl<'a> FindToken<char> for &'a str { |
912 | 2.61M | fn find_token(&self, token: char) -> bool { |
913 | 5.06M | self.chars().any(|i| i == token) Unexecuted instantiation: <&str as nom::traits::FindToken<char>>::find_token::{closure#0}<&str as nom::traits::FindToken<char>>::find_token::{closure#0}Line | Count | Source | 913 | 5.06M | self.chars().any(|i| i == token) |
|
914 | 2.61M | } Unexecuted instantiation: <&str as nom::traits::FindToken<char>>::find_token <&str as nom::traits::FindToken<char>>::find_token Line | Count | Source | 912 | 2.61M | fn find_token(&self, token: char) -> bool { | 913 | 2.61M | self.chars().any(|i| i == token) | 914 | 2.61M | } |
|
915 | | } |
916 | | |
917 | | impl<'a> FindToken<char> for &'a [char] { |
918 | 0 | fn find_token(&self, token: char) -> bool { |
919 | 0 | self.iter().any(|i| *i == token) Unexecuted instantiation: <&[char] as nom::traits::FindToken<char>>::find_token::{closure#0}Unexecuted instantiation: <&[char] as nom::traits::FindToken<char>>::find_token::{closure#0} |
920 | 0 | } Unexecuted instantiation: <&[char] as nom::traits::FindToken<char>>::find_token Unexecuted instantiation: <&[char] as nom::traits::FindToken<char>>::find_token |
921 | | } |
922 | | |
923 | | impl<'a, 'b> FindToken<&'a char> for &'b [char] { |
924 | 0 | fn find_token(&self, token: &char) -> bool { |
925 | 0 | self.find_token(*token) |
926 | 0 | } Unexecuted instantiation: <&[char] as nom::traits::FindToken<&char>>::find_token Unexecuted instantiation: <&[char] as nom::traits::FindToken<&char>>::find_token |
927 | | } |
928 | | |
929 | | /// Look for a substring in self |
930 | | pub trait FindSubstring<T> { |
931 | | /// Returns the byte position of the substring if it is found |
932 | | fn find_substring(&self, substr: T) -> Option<usize>; |
933 | | } |
934 | | |
935 | | impl<'a, 'b> FindSubstring<&'b [u8]> for &'a [u8] { |
936 | 43.2M | fn find_substring(&self, substr: &'b [u8]) -> Option<usize> { |
937 | 43.2M | if substr.len() > self.len() { |
938 | 380k | return None; |
939 | 42.9M | } |
940 | | |
941 | 42.9M | let (&substr_first, substr_rest) = match substr.split_first() { |
942 | 42.9M | Some(split) => split, |
943 | | // an empty substring is found at position 0 |
944 | | // This matches the behavior of str.find(""). |
945 | 0 | None => return Some(0), |
946 | | }; |
947 | | |
948 | 42.9M | if substr_rest.is_empty() { |
949 | 25.9M | return memchr::memchr(substr_first, self); |
950 | 16.9M | } |
951 | | |
952 | 16.9M | let mut offset = 0; |
953 | 16.9M | let haystack = &self[..self.len() - substr_rest.len()]; |
954 | | |
955 | 47.6M | while let Some(position) = memchr::memchr(substr_first, &haystack[offset..]) { |
956 | 47.5M | offset += position; |
957 | 47.5M | let next_offset = offset + 1; |
958 | 47.5M | if &self[next_offset..][..substr_rest.len()] == substr_rest { |
959 | 16.8M | return Some(offset); |
960 | 30.7M | } |
961 | | |
962 | 30.7M | offset = next_offset; |
963 | | } |
964 | | |
965 | 139k | None |
966 | 43.2M | } <&[u8] as nom::traits::FindSubstring<&[u8]>>::find_substring Line | Count | Source | 936 | 17.0M | fn find_substring(&self, substr: &'b [u8]) -> Option<usize> { | 937 | 17.0M | if substr.len() > self.len() { | 938 | 276k | return None; | 939 | 16.7M | } | 940 | | | 941 | 16.7M | let (&substr_first, substr_rest) = match substr.split_first() { | 942 | 16.7M | Some(split) => split, | 943 | | // an empty substring is found at position 0 | 944 | | // This matches the behavior of str.find(""). | 945 | 0 | None => return Some(0), | 946 | | }; | 947 | | | 948 | 16.7M | if substr_rest.is_empty() { | 949 | 0 | return memchr::memchr(substr_first, self); | 950 | 16.7M | } | 951 | | | 952 | 16.7M | let mut offset = 0; | 953 | 16.7M | let haystack = &self[..self.len() - substr_rest.len()]; | 954 | | | 955 | 21.3M | while let Some(position) = memchr::memchr(substr_first, &haystack[offset..]) { | 956 | 21.3M | offset += position; | 957 | 21.3M | let next_offset = offset + 1; | 958 | 21.3M | if &self[next_offset..][..substr_rest.len()] == substr_rest { | 959 | 16.7M | return Some(offset); | 960 | 4.60M | } | 961 | | | 962 | 4.60M | offset = next_offset; | 963 | | } | 964 | | | 965 | 7.07k | None | 966 | 17.0M | } |
<&[u8] as nom::traits::FindSubstring<&[u8]>>::find_substring Line | Count | Source | 936 | 26.2M | fn find_substring(&self, substr: &'b [u8]) -> Option<usize> { | 937 | 26.2M | if substr.len() > self.len() { | 938 | 103k | return None; | 939 | 26.1M | } | 940 | | | 941 | 26.1M | let (&substr_first, substr_rest) = match substr.split_first() { | 942 | 26.1M | Some(split) => split, | 943 | | // an empty substring is found at position 0 | 944 | | // This matches the behavior of str.find(""). | 945 | 0 | None => return Some(0), | 946 | | }; | 947 | | | 948 | 26.1M | if substr_rest.is_empty() { | 949 | 25.9M | return memchr::memchr(substr_first, self); | 950 | 220k | } | 951 | | | 952 | 220k | let mut offset = 0; | 953 | 220k | let haystack = &self[..self.len() - substr_rest.len()]; | 954 | | | 955 | 26.3M | while let Some(position) = memchr::memchr(substr_first, &haystack[offset..]) { | 956 | 26.2M | offset += position; | 957 | 26.2M | let next_offset = offset + 1; | 958 | 26.2M | if &self[next_offset..][..substr_rest.len()] == substr_rest { | 959 | 88.7k | return Some(offset); | 960 | 26.1M | } | 961 | | | 962 | 26.1M | offset = next_offset; | 963 | | } | 964 | | | 965 | 131k | None | 966 | 26.2M | } |
|
967 | | } |
968 | | |
969 | | impl<'a, 'b> FindSubstring<&'b str> for &'a [u8] { |
970 | 21.0M | fn find_substring(&self, substr: &'b str) -> Option<usize> { |
971 | 21.0M | self.find_substring(AsBytes::as_bytes(substr)) |
972 | 21.0M | } Unexecuted instantiation: <&[u8] as nom::traits::FindSubstring<&str>>::find_substring <&[u8] as nom::traits::FindSubstring<&str>>::find_substring Line | Count | Source | 970 | 21.0M | fn find_substring(&self, substr: &'b str) -> Option<usize> { | 971 | 21.0M | self.find_substring(AsBytes::as_bytes(substr)) | 972 | 21.0M | } |
|
973 | | } |
974 | | |
975 | | impl<'a, 'b> FindSubstring<&'b str> for &'a str { |
976 | | //returns byte index |
977 | 0 | fn find_substring(&self, substr: &'b str) -> Option<usize> { |
978 | 0 | self.find(substr) |
979 | 0 | } Unexecuted instantiation: <&str as nom::traits::FindSubstring<&str>>::find_substring Unexecuted instantiation: <&str as nom::traits::FindSubstring<&str>>::find_substring |
980 | | } |
981 | | |
982 | | /// Used to integrate `str`'s `parse()` method |
983 | | pub trait ParseTo<R> { |
984 | | /// Succeeds if `parse()` succeeded. The byte slice implementation |
985 | | /// will first convert it to a `&str`, then apply the `parse()` function |
986 | | fn parse_to(&self) -> Option<R>; |
987 | | } |
988 | | |
989 | | impl<'a, R: FromStr> ParseTo<R> for &'a [u8] { |
990 | 0 | fn parse_to(&self) -> Option<R> { |
991 | 0 | from_utf8(self).ok().and_then(|s| s.parse().ok()) Unexecuted instantiation: <&[u8] as nom::traits::ParseTo<_>>::parse_to::{closure#0}Unexecuted instantiation: <&[u8] as nom::traits::ParseTo<_>>::parse_to::{closure#0} |
992 | 0 | } Unexecuted instantiation: <&[u8] as nom::traits::ParseTo<_>>::parse_to Unexecuted instantiation: <&[u8] as nom::traits::ParseTo<_>>::parse_to |
993 | | } |
994 | | |
995 | | impl<'a, R: FromStr> ParseTo<R> for &'a str { |
996 | 0 | fn parse_to(&self) -> Option<R> { |
997 | 0 | self.parse().ok() |
998 | 0 | } Unexecuted instantiation: <&str as nom::traits::ParseTo<_>>::parse_to Unexecuted instantiation: <&str as nom::traits::ParseTo<f64>>::parse_to Unexecuted instantiation: <&str as nom::traits::ParseTo<_>>::parse_to |
999 | | } |
1000 | | |
1001 | | /// Slicing operations using ranges. |
1002 | | /// |
1003 | | /// This trait is loosely based on |
1004 | | /// `Index`, but can actually return |
1005 | | /// something else than a `&[T]` or `&str` |
1006 | | pub trait Slice<R> { |
1007 | | /// Slices self according to the range argument |
1008 | | fn slice(&self, range: R) -> Self; |
1009 | | } |
1010 | | |
1011 | | macro_rules! impl_fn_slice { |
1012 | | ( $ty:ty ) => { |
1013 | 1.20G | fn slice(&self, range: $ty) -> Self { |
1014 | 1.20G | &self[range] |
1015 | 1.20G | } <&[u8] as nom::traits::Slice<core::ops::range::RangeFrom<usize>>>::slice Line | Count | Source | 1013 | 365M | fn slice(&self, range: $ty) -> Self { | 1014 | 365M | &self[range] | 1015 | 365M | } |
<&[u8] as nom::traits::Slice<core::ops::range::Range<usize>>>::slice Line | Count | Source | 1013 | 16.7M | fn slice(&self, range: $ty) -> Self { | 1014 | 16.7M | &self[range] | 1015 | 16.7M | } |
<&[u8] as nom::traits::Slice<core::ops::range::RangeFrom<usize>>>::slice Line | Count | Source | 1013 | 16.8M | fn slice(&self, range: $ty) -> Self { | 1014 | 16.8M | &self[range] | 1015 | 16.8M | } |
<&[u8] as nom::traits::Slice<core::ops::range::RangeFrom<usize>>>::slice Line | Count | Source | 1013 | 4.29M | fn slice(&self, range: $ty) -> Self { | 1014 | 4.29M | &self[range] | 1015 | 4.29M | } |
<&[u8] as nom::traits::Slice<core::ops::range::RangeFrom<usize>>>::slice Line | Count | Source | 1013 | 5.80M | fn slice(&self, range: $ty) -> Self { | 1014 | 5.80M | &self[range] | 1015 | 5.80M | } |
<&[u8] as nom::traits::Slice<core::ops::range::RangeFrom<usize>>>::slice Line | Count | Source | 1013 | 9.24M | fn slice(&self, range: $ty) -> Self { | 1014 | 9.24M | &self[range] | 1015 | 9.24M | } |
<&[u8] as nom::traits::Slice<core::ops::range::RangeFrom<usize>>>::slice Line | Count | Source | 1013 | 22.4k | fn slice(&self, range: $ty) -> Self { | 1014 | 22.4k | &self[range] | 1015 | 22.4k | } |
<&[u8] as nom::traits::Slice<core::ops::range::RangeFrom<usize>>>::slice Line | Count | Source | 1013 | 6.97M | fn slice(&self, range: $ty) -> Self { | 1014 | 6.97M | &self[range] | 1015 | 6.97M | } |
<&[u8] as nom::traits::Slice<core::ops::range::RangeFrom<usize>>>::slice Line | Count | Source | 1013 | 14.7k | fn slice(&self, range: $ty) -> Self { | 1014 | 14.7k | &self[range] | 1015 | 14.7k | } |
Unexecuted instantiation: <&[u8] as nom::traits::Slice<core::ops::range::RangeFrom<usize>>>::slice Unexecuted instantiation: <&str as nom::traits::Slice<core::ops::range::Range<usize>>>::slice Unexecuted instantiation: <&str as nom::traits::Slice<core::ops::range::RangeTo<usize>>>::slice Unexecuted instantiation: <&str as nom::traits::Slice<core::ops::range::RangeFrom<usize>>>::slice Unexecuted instantiation: <&[_] as nom::traits::Slice<core::ops::range::Range<usize>>>::slice Unexecuted instantiation: <&[_] as nom::traits::Slice<core::ops::range::RangeTo<usize>>>::slice Unexecuted instantiation: <&[_] as nom::traits::Slice<core::ops::range::RangeFrom<usize>>>::slice Unexecuted instantiation: <&[_] as nom::traits::Slice<core::ops::range::RangeFull>>::slice Unexecuted instantiation: <&str as nom::traits::Slice<core::ops::range::RangeFull>>::slice <&[u8] as nom::traits::Slice<core::ops::range::Range<usize>>>::slice Line | Count | Source | 1013 | 1.56M | fn slice(&self, range: $ty) -> Self { | 1014 | 1.56M | &self[range] | 1015 | 1.56M | } |
<&[u8] as nom::traits::Slice<core::ops::range::RangeFrom<usize>>>::slice Line | Count | Source | 1013 | 742M | fn slice(&self, range: $ty) -> Self { | 1014 | 742M | &self[range] | 1015 | 742M | } |
<&[u8] as nom::traits::Slice<core::ops::range::RangeFrom<usize>>>::slice Line | Count | Source | 1013 | 8.80M | fn slice(&self, range: $ty) -> Self { | 1014 | 8.80M | &self[range] | 1015 | 8.80M | } |
<&[u8] as nom::traits::Slice<core::ops::range::RangeFrom<usize>>>::slice Line | Count | Source | 1013 | 6.57M | fn slice(&self, range: $ty) -> Self { | 1014 | 6.57M | &self[range] | 1015 | 6.57M | } |
<&[u8] as nom::traits::Slice<core::ops::range::RangeFrom<usize>>>::slice Line | Count | Source | 1013 | 7.73M | fn slice(&self, range: $ty) -> Self { | 1014 | 7.73M | &self[range] | 1015 | 7.73M | } |
<&[u8] as nom::traits::Slice<core::ops::range::RangeFrom<usize>>>::slice Line | Count | Source | 1013 | 23.9k | fn slice(&self, range: $ty) -> Self { | 1014 | 23.9k | &self[range] | 1015 | 23.9k | } |
<&[u8] as nom::traits::Slice<core::ops::range::RangeFrom<usize>>>::slice Line | Count | Source | 1013 | 10.1M | fn slice(&self, range: $ty) -> Self { | 1014 | 10.1M | &self[range] | 1015 | 10.1M | } |
<&[u8] as nom::traits::Slice<core::ops::range::RangeFrom<usize>>>::slice Line | Count | Source | 1013 | 100k | fn slice(&self, range: $ty) -> Self { | 1014 | 100k | &self[range] | 1015 | 100k | } |
<&[u8] as nom::traits::Slice<core::ops::range::RangeFrom<usize>>>::slice Line | Count | Source | 1013 | 2.43k | fn slice(&self, range: $ty) -> Self { | 1014 | 2.43k | &self[range] | 1015 | 2.43k | } |
Unexecuted instantiation: <&[u8] as nom::traits::Slice<core::ops::range::RangeFrom<usize>>>::slice Unexecuted instantiation: <&str as nom::traits::Slice<core::ops::range::Range<usize>>>::slice Unexecuted instantiation: <&str as nom::traits::Slice<core::ops::range::RangeTo<usize>>>::slice <&str as nom::traits::Slice<core::ops::range::RangeFrom<usize>>>::slice Line | Count | Source | 1013 | 80.4k | fn slice(&self, range: $ty) -> Self { | 1014 | 80.4k | &self[range] | 1015 | 80.4k | } |
Unexecuted instantiation: <&[_] as nom::traits::Slice<core::ops::range::Range<usize>>>::slice Unexecuted instantiation: <&[_] as nom::traits::Slice<core::ops::range::RangeTo<usize>>>::slice Unexecuted instantiation: <&[_] as nom::traits::Slice<core::ops::range::RangeFrom<usize>>>::slice Unexecuted instantiation: <&[_] as nom::traits::Slice<core::ops::range::RangeFull>>::slice Unexecuted instantiation: <&str as nom::traits::Slice<core::ops::range::RangeFull>>::slice |
1016 | | }; |
1017 | | } |
1018 | | |
1019 | | macro_rules! slice_range_impl { |
1020 | | ( [ $for_type:ident ], $ty:ty ) => { |
1021 | | impl<'a, $for_type> Slice<$ty> for &'a [$for_type] { |
1022 | | impl_fn_slice!($ty); |
1023 | | } |
1024 | | }; |
1025 | | ( $for_type:ty, $ty:ty ) => { |
1026 | | impl<'a> Slice<$ty> for &'a $for_type { |
1027 | | impl_fn_slice!($ty); |
1028 | | } |
1029 | | }; |
1030 | | } |
1031 | | |
1032 | | macro_rules! slice_ranges_impl { |
1033 | | ( [ $for_type:ident ] ) => { |
1034 | | slice_range_impl! {[$for_type], Range<usize>} |
1035 | | slice_range_impl! {[$for_type], RangeTo<usize>} |
1036 | | slice_range_impl! {[$for_type], RangeFrom<usize>} |
1037 | | slice_range_impl! {[$for_type], RangeFull} |
1038 | | }; |
1039 | | ( $for_type:ty ) => { |
1040 | | slice_range_impl! {$for_type, Range<usize>} |
1041 | | slice_range_impl! {$for_type, RangeTo<usize>} |
1042 | | slice_range_impl! {$for_type, RangeFrom<usize>} |
1043 | | slice_range_impl! {$for_type, RangeFull} |
1044 | | }; |
1045 | | } |
1046 | | |
1047 | | slice_ranges_impl! {str} |
1048 | | slice_ranges_impl! {[T]} |
1049 | | |
1050 | | macro_rules! array_impls { |
1051 | | ($($N:expr)+) => { |
1052 | | $( |
1053 | | impl InputLength for [u8; $N] { |
1054 | | #[inline] |
1055 | 957k | fn input_len(&self) -> usize { |
1056 | 957k | self.len() |
1057 | 957k | } Unexecuted instantiation: <[u8; 2] as nom::traits::InputLength>::input_len Unexecuted instantiation: <[u8; 4] as nom::traits::InputLength>::input_len Unexecuted instantiation: <[u8; 5] as nom::traits::InputLength>::input_len Unexecuted instantiation: <[u8; 6] as nom::traits::InputLength>::input_len Unexecuted instantiation: <[u8; 7] as nom::traits::InputLength>::input_len Unexecuted instantiation: <[u8; 0] as nom::traits::InputLength>::input_len Unexecuted instantiation: <[u8; 1] as nom::traits::InputLength>::input_len Unexecuted instantiation: <[u8; 3] as nom::traits::InputLength>::input_len Unexecuted instantiation: <[u8; 8] as nom::traits::InputLength>::input_len Unexecuted instantiation: <[u8; 13] as nom::traits::InputLength>::input_len Unexecuted instantiation: <[u8; 14] as nom::traits::InputLength>::input_len Unexecuted instantiation: <[u8; 15] as nom::traits::InputLength>::input_len Unexecuted instantiation: <[u8; 16] as nom::traits::InputLength>::input_len Unexecuted instantiation: <[u8; 9] as nom::traits::InputLength>::input_len Unexecuted instantiation: <[u8; 10] as nom::traits::InputLength>::input_len Unexecuted instantiation: <[u8; 11] as nom::traits::InputLength>::input_len Unexecuted instantiation: <[u8; 12] as nom::traits::InputLength>::input_len Unexecuted instantiation: <[u8; 17] as nom::traits::InputLength>::input_len Unexecuted instantiation: <[u8; 22] as nom::traits::InputLength>::input_len Unexecuted instantiation: <[u8; 23] as nom::traits::InputLength>::input_len Unexecuted instantiation: <[u8; 24] as nom::traits::InputLength>::input_len Unexecuted instantiation: <[u8; 25] as nom::traits::InputLength>::input_len Unexecuted instantiation: <[u8; 18] as nom::traits::InputLength>::input_len Unexecuted instantiation: <[u8; 19] as nom::traits::InputLength>::input_len Unexecuted instantiation: <[u8; 20] as nom::traits::InputLength>::input_len Unexecuted instantiation: <[u8; 21] as nom::traits::InputLength>::input_len Unexecuted instantiation: <[u8; 26] as nom::traits::InputLength>::input_len Unexecuted instantiation: <[u8; 31] as nom::traits::InputLength>::input_len Unexecuted instantiation: <[u8; 32] as nom::traits::InputLength>::input_len Unexecuted instantiation: <[u8; 27] as nom::traits::InputLength>::input_len Unexecuted instantiation: <[u8; 28] as nom::traits::InputLength>::input_len Unexecuted instantiation: <[u8; 29] as nom::traits::InputLength>::input_len Unexecuted instantiation: <[u8; 30] as nom::traits::InputLength>::input_len <[u8; 1] as nom::traits::InputLength>::input_len Line | Count | Source | 1055 | 957k | fn input_len(&self) -> usize { | 1056 | 957k | self.len() | 1057 | 957k | } |
Unexecuted instantiation: <[u8; 2] as nom::traits::InputLength>::input_len Unexecuted instantiation: <[u8; 4] as nom::traits::InputLength>::input_len Unexecuted instantiation: <[u8; 5] as nom::traits::InputLength>::input_len Unexecuted instantiation: <[u8; 6] as nom::traits::InputLength>::input_len Unexecuted instantiation: <[u8; 7] as nom::traits::InputLength>::input_len Unexecuted instantiation: <[u8; 0] as nom::traits::InputLength>::input_len Unexecuted instantiation: <[u8; 3] as nom::traits::InputLength>::input_len Unexecuted instantiation: <[u8; 8] as nom::traits::InputLength>::input_len Unexecuted instantiation: <[u8; 13] as nom::traits::InputLength>::input_len Unexecuted instantiation: <[u8; 14] as nom::traits::InputLength>::input_len Unexecuted instantiation: <[u8; 15] as nom::traits::InputLength>::input_len Unexecuted instantiation: <[u8; 16] as nom::traits::InputLength>::input_len Unexecuted instantiation: <[u8; 9] as nom::traits::InputLength>::input_len Unexecuted instantiation: <[u8; 10] as nom::traits::InputLength>::input_len Unexecuted instantiation: <[u8; 11] as nom::traits::InputLength>::input_len Unexecuted instantiation: <[u8; 12] as nom::traits::InputLength>::input_len Unexecuted instantiation: <[u8; 17] as nom::traits::InputLength>::input_len Unexecuted instantiation: <[u8; 22] as nom::traits::InputLength>::input_len Unexecuted instantiation: <[u8; 23] as nom::traits::InputLength>::input_len Unexecuted instantiation: <[u8; 24] as nom::traits::InputLength>::input_len Unexecuted instantiation: <[u8; 25] as nom::traits::InputLength>::input_len Unexecuted instantiation: <[u8; 18] as nom::traits::InputLength>::input_len Unexecuted instantiation: <[u8; 19] as nom::traits::InputLength>::input_len Unexecuted instantiation: <[u8; 20] as nom::traits::InputLength>::input_len Unexecuted instantiation: <[u8; 21] as nom::traits::InputLength>::input_len Unexecuted instantiation: <[u8; 26] as nom::traits::InputLength>::input_len Unexecuted instantiation: <[u8; 31] as nom::traits::InputLength>::input_len Unexecuted instantiation: <[u8; 32] as nom::traits::InputLength>::input_len Unexecuted instantiation: <[u8; 27] as nom::traits::InputLength>::input_len Unexecuted instantiation: <[u8; 28] as nom::traits::InputLength>::input_len Unexecuted instantiation: <[u8; 29] as nom::traits::InputLength>::input_len Unexecuted instantiation: <[u8; 30] as nom::traits::InputLength>::input_len |
1058 | | } |
1059 | | |
1060 | | impl<'a> InputLength for &'a [u8; $N] { |
1061 | | #[inline] |
1062 | 5.87M | fn input_len(&self) -> usize { |
1063 | 5.87M | self.len() |
1064 | 5.87M | } <&[u8; 4] as nom::traits::InputLength>::input_len Line | Count | Source | 1062 | 9.69k | fn input_len(&self) -> usize { | 1063 | 9.69k | self.len() | 1064 | 9.69k | } |
Unexecuted instantiation: <&[u8; 5] as nom::traits::InputLength>::input_len Unexecuted instantiation: <&[u8; 6] as nom::traits::InputLength>::input_len Unexecuted instantiation: <&[u8; 7] as nom::traits::InputLength>::input_len Unexecuted instantiation: <&[u8; 0] as nom::traits::InputLength>::input_len Unexecuted instantiation: <&[u8; 1] as nom::traits::InputLength>::input_len Unexecuted instantiation: <&[u8; 2] as nom::traits::InputLength>::input_len Unexecuted instantiation: <&[u8; 3] as nom::traits::InputLength>::input_len Unexecuted instantiation: <&[u8; 8] as nom::traits::InputLength>::input_len Unexecuted instantiation: <&[u8; 13] as nom::traits::InputLength>::input_len Unexecuted instantiation: <&[u8; 14] as nom::traits::InputLength>::input_len Unexecuted instantiation: <&[u8; 15] as nom::traits::InputLength>::input_len Unexecuted instantiation: <&[u8; 16] as nom::traits::InputLength>::input_len Unexecuted instantiation: <&[u8; 9] as nom::traits::InputLength>::input_len Unexecuted instantiation: <&[u8; 10] as nom::traits::InputLength>::input_len Unexecuted instantiation: <&[u8; 11] as nom::traits::InputLength>::input_len Unexecuted instantiation: <&[u8; 12] as nom::traits::InputLength>::input_len Unexecuted instantiation: <&[u8; 17] as nom::traits::InputLength>::input_len Unexecuted instantiation: <&[u8; 22] as nom::traits::InputLength>::input_len Unexecuted instantiation: <&[u8; 23] as nom::traits::InputLength>::input_len Unexecuted instantiation: <&[u8; 24] as nom::traits::InputLength>::input_len Unexecuted instantiation: <&[u8; 18] as nom::traits::InputLength>::input_len Unexecuted instantiation: <&[u8; 19] as nom::traits::InputLength>::input_len Unexecuted instantiation: <&[u8; 20] as nom::traits::InputLength>::input_len Unexecuted instantiation: <&[u8; 21] as nom::traits::InputLength>::input_len Unexecuted instantiation: <&[u8; 25] as nom::traits::InputLength>::input_len Unexecuted instantiation: <&[u8; 26] as nom::traits::InputLength>::input_len Unexecuted instantiation: <&[u8; 31] as nom::traits::InputLength>::input_len Unexecuted instantiation: <&[u8; 32] as nom::traits::InputLength>::input_len Unexecuted instantiation: <&[u8; 27] as nom::traits::InputLength>::input_len Unexecuted instantiation: <&[u8; 28] as nom::traits::InputLength>::input_len Unexecuted instantiation: <&[u8; 29] as nom::traits::InputLength>::input_len Unexecuted instantiation: <&[u8; 30] as nom::traits::InputLength>::input_len <&[u8; 8] as nom::traits::InputLength>::input_len Line | Count | Source | 1062 | 73.7k | fn input_len(&self) -> usize { | 1063 | 73.7k | self.len() | 1064 | 73.7k | } |
<&[u8; 9] as nom::traits::InputLength>::input_len Line | Count | Source | 1062 | 1.21k | fn input_len(&self) -> usize { | 1063 | 1.21k | self.len() | 1064 | 1.21k | } |
<&[u8; 1] as nom::traits::InputLength>::input_len Line | Count | Source | 1062 | 200k | fn input_len(&self) -> usize { | 1063 | 200k | self.len() | 1064 | 200k | } |
<&[u8; 3] as nom::traits::InputLength>::input_len Line | Count | Source | 1062 | 2.78M | fn input_len(&self) -> usize { | 1063 | 2.78M | self.len() | 1064 | 2.78M | } |
<&[u8; 4] as nom::traits::InputLength>::input_len Line | Count | Source | 1062 | 2.79M | fn input_len(&self) -> usize { | 1063 | 2.79M | self.len() | 1064 | 2.79M | } |
Unexecuted instantiation: <&[u8; 5] as nom::traits::InputLength>::input_len Unexecuted instantiation: <&[u8; 6] as nom::traits::InputLength>::input_len Unexecuted instantiation: <&[u8; 7] as nom::traits::InputLength>::input_len Unexecuted instantiation: <&[u8; 0] as nom::traits::InputLength>::input_len Unexecuted instantiation: <&[u8; 2] as nom::traits::InputLength>::input_len Unexecuted instantiation: <&[u8; 13] as nom::traits::InputLength>::input_len Unexecuted instantiation: <&[u8; 14] as nom::traits::InputLength>::input_len Unexecuted instantiation: <&[u8; 15] as nom::traits::InputLength>::input_len Unexecuted instantiation: <&[u8; 16] as nom::traits::InputLength>::input_len Unexecuted instantiation: <&[u8; 10] as nom::traits::InputLength>::input_len Unexecuted instantiation: <&[u8; 11] as nom::traits::InputLength>::input_len Unexecuted instantiation: <&[u8; 12] as nom::traits::InputLength>::input_len Unexecuted instantiation: <&[u8; 17] as nom::traits::InputLength>::input_len Unexecuted instantiation: <&[u8; 22] as nom::traits::InputLength>::input_len Unexecuted instantiation: <&[u8; 23] as nom::traits::InputLength>::input_len Unexecuted instantiation: <&[u8; 24] as nom::traits::InputLength>::input_len Unexecuted instantiation: <&[u8; 18] as nom::traits::InputLength>::input_len Unexecuted instantiation: <&[u8; 19] as nom::traits::InputLength>::input_len Unexecuted instantiation: <&[u8; 20] as nom::traits::InputLength>::input_len Unexecuted instantiation: <&[u8; 21] as nom::traits::InputLength>::input_len Unexecuted instantiation: <&[u8; 25] as nom::traits::InputLength>::input_len Unexecuted instantiation: <&[u8; 26] as nom::traits::InputLength>::input_len Unexecuted instantiation: <&[u8; 31] as nom::traits::InputLength>::input_len Unexecuted instantiation: <&[u8; 32] as nom::traits::InputLength>::input_len Unexecuted instantiation: <&[u8; 27] as nom::traits::InputLength>::input_len Unexecuted instantiation: <&[u8; 28] as nom::traits::InputLength>::input_len Unexecuted instantiation: <&[u8; 29] as nom::traits::InputLength>::input_len Unexecuted instantiation: <&[u8; 30] as nom::traits::InputLength>::input_len |
1065 | | } |
1066 | | |
1067 | | impl<'a> InputIter for &'a [u8; $N] { |
1068 | | type Item = u8; |
1069 | | type Iter = Enumerate<Self::IterElem>; |
1070 | | type IterElem = Copied<Iter<'a, u8>>; |
1071 | | |
1072 | 0 | fn iter_indices(&self) -> Self::Iter { |
1073 | 0 | (&self[..]).iter_indices() |
1074 | 0 | } Unexecuted instantiation: <&[u8; 4] as nom::traits::InputIter>::iter_indices Unexecuted instantiation: <&[u8; 5] as nom::traits::InputIter>::iter_indices Unexecuted instantiation: <&[u8; 6] as nom::traits::InputIter>::iter_indices Unexecuted instantiation: <&[u8; 7] as nom::traits::InputIter>::iter_indices Unexecuted instantiation: <&[u8; 0] as nom::traits::InputIter>::iter_indices Unexecuted instantiation: <&[u8; 1] as nom::traits::InputIter>::iter_indices Unexecuted instantiation: <&[u8; 2] as nom::traits::InputIter>::iter_indices Unexecuted instantiation: <&[u8; 3] as nom::traits::InputIter>::iter_indices Unexecuted instantiation: <&[u8; 8] as nom::traits::InputIter>::iter_indices Unexecuted instantiation: <&[u8; 13] as nom::traits::InputIter>::iter_indices Unexecuted instantiation: <&[u8; 14] as nom::traits::InputIter>::iter_indices Unexecuted instantiation: <&[u8; 15] as nom::traits::InputIter>::iter_indices Unexecuted instantiation: <&[u8; 9] as nom::traits::InputIter>::iter_indices Unexecuted instantiation: <&[u8; 10] as nom::traits::InputIter>::iter_indices Unexecuted instantiation: <&[u8; 11] as nom::traits::InputIter>::iter_indices Unexecuted instantiation: <&[u8; 12] as nom::traits::InputIter>::iter_indices Unexecuted instantiation: <&[u8; 16] as nom::traits::InputIter>::iter_indices Unexecuted instantiation: <&[u8; 17] as nom::traits::InputIter>::iter_indices Unexecuted instantiation: <&[u8; 22] as nom::traits::InputIter>::iter_indices Unexecuted instantiation: <&[u8; 23] as nom::traits::InputIter>::iter_indices Unexecuted instantiation: <&[u8; 24] as nom::traits::InputIter>::iter_indices Unexecuted instantiation: <&[u8; 18] as nom::traits::InputIter>::iter_indices Unexecuted instantiation: <&[u8; 19] as nom::traits::InputIter>::iter_indices Unexecuted instantiation: <&[u8; 20] as nom::traits::InputIter>::iter_indices Unexecuted instantiation: <&[u8; 21] as nom::traits::InputIter>::iter_indices Unexecuted instantiation: <&[u8; 25] as nom::traits::InputIter>::iter_indices Unexecuted instantiation: <&[u8; 26] as nom::traits::InputIter>::iter_indices Unexecuted instantiation: <&[u8; 30] as nom::traits::InputIter>::iter_indices Unexecuted instantiation: <&[u8; 31] as nom::traits::InputIter>::iter_indices Unexecuted instantiation: <&[u8; 32] as nom::traits::InputIter>::iter_indices Unexecuted instantiation: <&[u8; 27] as nom::traits::InputIter>::iter_indices Unexecuted instantiation: <&[u8; 28] as nom::traits::InputIter>::iter_indices Unexecuted instantiation: <&[u8; 29] as nom::traits::InputIter>::iter_indices Unexecuted instantiation: <&[u8; 4] as nom::traits::InputIter>::iter_indices Unexecuted instantiation: <&[u8; 5] as nom::traits::InputIter>::iter_indices Unexecuted instantiation: <&[u8; 6] as nom::traits::InputIter>::iter_indices Unexecuted instantiation: <&[u8; 7] as nom::traits::InputIter>::iter_indices Unexecuted instantiation: <&[u8; 0] as nom::traits::InputIter>::iter_indices Unexecuted instantiation: <&[u8; 1] as nom::traits::InputIter>::iter_indices Unexecuted instantiation: <&[u8; 2] as nom::traits::InputIter>::iter_indices Unexecuted instantiation: <&[u8; 3] as nom::traits::InputIter>::iter_indices Unexecuted instantiation: <&[u8; 8] as nom::traits::InputIter>::iter_indices Unexecuted instantiation: <&[u8; 13] as nom::traits::InputIter>::iter_indices Unexecuted instantiation: <&[u8; 14] as nom::traits::InputIter>::iter_indices Unexecuted instantiation: <&[u8; 15] as nom::traits::InputIter>::iter_indices Unexecuted instantiation: <&[u8; 9] as nom::traits::InputIter>::iter_indices Unexecuted instantiation: <&[u8; 10] as nom::traits::InputIter>::iter_indices Unexecuted instantiation: <&[u8; 11] as nom::traits::InputIter>::iter_indices Unexecuted instantiation: <&[u8; 12] as nom::traits::InputIter>::iter_indices Unexecuted instantiation: <&[u8; 16] as nom::traits::InputIter>::iter_indices Unexecuted instantiation: <&[u8; 17] as nom::traits::InputIter>::iter_indices Unexecuted instantiation: <&[u8; 22] as nom::traits::InputIter>::iter_indices Unexecuted instantiation: <&[u8; 23] as nom::traits::InputIter>::iter_indices Unexecuted instantiation: <&[u8; 24] as nom::traits::InputIter>::iter_indices Unexecuted instantiation: <&[u8; 18] as nom::traits::InputIter>::iter_indices Unexecuted instantiation: <&[u8; 19] as nom::traits::InputIter>::iter_indices Unexecuted instantiation: <&[u8; 20] as nom::traits::InputIter>::iter_indices Unexecuted instantiation: <&[u8; 21] as nom::traits::InputIter>::iter_indices Unexecuted instantiation: <&[u8; 25] as nom::traits::InputIter>::iter_indices Unexecuted instantiation: <&[u8; 26] as nom::traits::InputIter>::iter_indices Unexecuted instantiation: <&[u8; 30] as nom::traits::InputIter>::iter_indices Unexecuted instantiation: <&[u8; 31] as nom::traits::InputIter>::iter_indices Unexecuted instantiation: <&[u8; 32] as nom::traits::InputIter>::iter_indices Unexecuted instantiation: <&[u8; 27] as nom::traits::InputIter>::iter_indices Unexecuted instantiation: <&[u8; 28] as nom::traits::InputIter>::iter_indices Unexecuted instantiation: <&[u8; 29] as nom::traits::InputIter>::iter_indices |
1075 | | |
1076 | 0 | fn iter_elements(&self) -> Self::IterElem { |
1077 | 0 | (&self[..]).iter_elements() |
1078 | 0 | } Unexecuted instantiation: <&[u8; 4] as nom::traits::InputIter>::iter_elements Unexecuted instantiation: <&[u8; 5] as nom::traits::InputIter>::iter_elements Unexecuted instantiation: <&[u8; 6] as nom::traits::InputIter>::iter_elements Unexecuted instantiation: <&[u8; 7] as nom::traits::InputIter>::iter_elements Unexecuted instantiation: <&[u8; 0] as nom::traits::InputIter>::iter_elements Unexecuted instantiation: <&[u8; 1] as nom::traits::InputIter>::iter_elements Unexecuted instantiation: <&[u8; 2] as nom::traits::InputIter>::iter_elements Unexecuted instantiation: <&[u8; 3] as nom::traits::InputIter>::iter_elements Unexecuted instantiation: <&[u8; 8] as nom::traits::InputIter>::iter_elements Unexecuted instantiation: <&[u8; 13] as nom::traits::InputIter>::iter_elements Unexecuted instantiation: <&[u8; 14] as nom::traits::InputIter>::iter_elements Unexecuted instantiation: <&[u8; 15] as nom::traits::InputIter>::iter_elements Unexecuted instantiation: <&[u8; 9] as nom::traits::InputIter>::iter_elements Unexecuted instantiation: <&[u8; 10] as nom::traits::InputIter>::iter_elements Unexecuted instantiation: <&[u8; 11] as nom::traits::InputIter>::iter_elements Unexecuted instantiation: <&[u8; 12] as nom::traits::InputIter>::iter_elements Unexecuted instantiation: <&[u8; 16] as nom::traits::InputIter>::iter_elements Unexecuted instantiation: <&[u8; 17] as nom::traits::InputIter>::iter_elements Unexecuted instantiation: <&[u8; 22] as nom::traits::InputIter>::iter_elements Unexecuted instantiation: <&[u8; 23] as nom::traits::InputIter>::iter_elements Unexecuted instantiation: <&[u8; 24] as nom::traits::InputIter>::iter_elements Unexecuted instantiation: <&[u8; 18] as nom::traits::InputIter>::iter_elements Unexecuted instantiation: <&[u8; 19] as nom::traits::InputIter>::iter_elements Unexecuted instantiation: <&[u8; 20] as nom::traits::InputIter>::iter_elements Unexecuted instantiation: <&[u8; 21] as nom::traits::InputIter>::iter_elements Unexecuted instantiation: <&[u8; 25] as nom::traits::InputIter>::iter_elements Unexecuted instantiation: <&[u8; 26] as nom::traits::InputIter>::iter_elements Unexecuted instantiation: <&[u8; 30] as nom::traits::InputIter>::iter_elements Unexecuted instantiation: <&[u8; 31] as nom::traits::InputIter>::iter_elements Unexecuted instantiation: <&[u8; 32] as nom::traits::InputIter>::iter_elements Unexecuted instantiation: <&[u8; 27] as nom::traits::InputIter>::iter_elements Unexecuted instantiation: <&[u8; 28] as nom::traits::InputIter>::iter_elements Unexecuted instantiation: <&[u8; 29] as nom::traits::InputIter>::iter_elements Unexecuted instantiation: <&[u8; 4] as nom::traits::InputIter>::iter_elements Unexecuted instantiation: <&[u8; 5] as nom::traits::InputIter>::iter_elements Unexecuted instantiation: <&[u8; 6] as nom::traits::InputIter>::iter_elements Unexecuted instantiation: <&[u8; 7] as nom::traits::InputIter>::iter_elements Unexecuted instantiation: <&[u8; 0] as nom::traits::InputIter>::iter_elements Unexecuted instantiation: <&[u8; 1] as nom::traits::InputIter>::iter_elements Unexecuted instantiation: <&[u8; 2] as nom::traits::InputIter>::iter_elements Unexecuted instantiation: <&[u8; 3] as nom::traits::InputIter>::iter_elements Unexecuted instantiation: <&[u8; 8] as nom::traits::InputIter>::iter_elements Unexecuted instantiation: <&[u8; 13] as nom::traits::InputIter>::iter_elements Unexecuted instantiation: <&[u8; 14] as nom::traits::InputIter>::iter_elements Unexecuted instantiation: <&[u8; 15] as nom::traits::InputIter>::iter_elements Unexecuted instantiation: <&[u8; 9] as nom::traits::InputIter>::iter_elements Unexecuted instantiation: <&[u8; 10] as nom::traits::InputIter>::iter_elements Unexecuted instantiation: <&[u8; 11] as nom::traits::InputIter>::iter_elements Unexecuted instantiation: <&[u8; 12] as nom::traits::InputIter>::iter_elements Unexecuted instantiation: <&[u8; 16] as nom::traits::InputIter>::iter_elements Unexecuted instantiation: <&[u8; 17] as nom::traits::InputIter>::iter_elements Unexecuted instantiation: <&[u8; 22] as nom::traits::InputIter>::iter_elements Unexecuted instantiation: <&[u8; 23] as nom::traits::InputIter>::iter_elements Unexecuted instantiation: <&[u8; 24] as nom::traits::InputIter>::iter_elements Unexecuted instantiation: <&[u8; 18] as nom::traits::InputIter>::iter_elements Unexecuted instantiation: <&[u8; 19] as nom::traits::InputIter>::iter_elements Unexecuted instantiation: <&[u8; 20] as nom::traits::InputIter>::iter_elements Unexecuted instantiation: <&[u8; 21] as nom::traits::InputIter>::iter_elements Unexecuted instantiation: <&[u8; 25] as nom::traits::InputIter>::iter_elements Unexecuted instantiation: <&[u8; 26] as nom::traits::InputIter>::iter_elements Unexecuted instantiation: <&[u8; 30] as nom::traits::InputIter>::iter_elements Unexecuted instantiation: <&[u8; 31] as nom::traits::InputIter>::iter_elements Unexecuted instantiation: <&[u8; 32] as nom::traits::InputIter>::iter_elements Unexecuted instantiation: <&[u8; 27] as nom::traits::InputIter>::iter_elements Unexecuted instantiation: <&[u8; 28] as nom::traits::InputIter>::iter_elements Unexecuted instantiation: <&[u8; 29] as nom::traits::InputIter>::iter_elements |
1079 | | |
1080 | 0 | fn position<P>(&self, predicate: P) -> Option<usize> |
1081 | 0 | where P: Fn(Self::Item) -> bool { |
1082 | 0 | (&self[..]).position(predicate) |
1083 | 0 | } Unexecuted instantiation: <&[u8; 4] as nom::traits::InputIter>::position::<_> Unexecuted instantiation: <&[u8; 5] as nom::traits::InputIter>::position::<_> Unexecuted instantiation: <&[u8; 6] as nom::traits::InputIter>::position::<_> Unexecuted instantiation: <&[u8; 7] as nom::traits::InputIter>::position::<_> Unexecuted instantiation: <&[u8; 0] as nom::traits::InputIter>::position::<_> Unexecuted instantiation: <&[u8; 1] as nom::traits::InputIter>::position::<_> Unexecuted instantiation: <&[u8; 2] as nom::traits::InputIter>::position::<_> Unexecuted instantiation: <&[u8; 3] as nom::traits::InputIter>::position::<_> Unexecuted instantiation: <&[u8; 8] as nom::traits::InputIter>::position::<_> Unexecuted instantiation: <&[u8; 13] as nom::traits::InputIter>::position::<_> Unexecuted instantiation: <&[u8; 14] as nom::traits::InputIter>::position::<_> Unexecuted instantiation: <&[u8; 15] as nom::traits::InputIter>::position::<_> Unexecuted instantiation: <&[u8; 9] as nom::traits::InputIter>::position::<_> Unexecuted instantiation: <&[u8; 10] as nom::traits::InputIter>::position::<_> Unexecuted instantiation: <&[u8; 11] as nom::traits::InputIter>::position::<_> Unexecuted instantiation: <&[u8; 12] as nom::traits::InputIter>::position::<_> Unexecuted instantiation: <&[u8; 16] as nom::traits::InputIter>::position::<_> Unexecuted instantiation: <&[u8; 17] as nom::traits::InputIter>::position::<_> Unexecuted instantiation: <&[u8; 22] as nom::traits::InputIter>::position::<_> Unexecuted instantiation: <&[u8; 23] as nom::traits::InputIter>::position::<_> Unexecuted instantiation: <&[u8; 24] as nom::traits::InputIter>::position::<_> Unexecuted instantiation: <&[u8; 18] as nom::traits::InputIter>::position::<_> Unexecuted instantiation: <&[u8; 19] as nom::traits::InputIter>::position::<_> Unexecuted instantiation: <&[u8; 20] as nom::traits::InputIter>::position::<_> Unexecuted instantiation: <&[u8; 21] as nom::traits::InputIter>::position::<_> Unexecuted instantiation: <&[u8; 25] as nom::traits::InputIter>::position::<_> Unexecuted instantiation: <&[u8; 26] as nom::traits::InputIter>::position::<_> Unexecuted instantiation: <&[u8; 30] as nom::traits::InputIter>::position::<_> Unexecuted instantiation: <&[u8; 31] as nom::traits::InputIter>::position::<_> Unexecuted instantiation: <&[u8; 32] as nom::traits::InputIter>::position::<_> Unexecuted instantiation: <&[u8; 27] as nom::traits::InputIter>::position::<_> Unexecuted instantiation: <&[u8; 28] as nom::traits::InputIter>::position::<_> Unexecuted instantiation: <&[u8; 29] as nom::traits::InputIter>::position::<_> Unexecuted instantiation: <&[u8; 4] as nom::traits::InputIter>::position::<_> Unexecuted instantiation: <&[u8; 5] as nom::traits::InputIter>::position::<_> Unexecuted instantiation: <&[u8; 6] as nom::traits::InputIter>::position::<_> Unexecuted instantiation: <&[u8; 7] as nom::traits::InputIter>::position::<_> Unexecuted instantiation: <&[u8; 0] as nom::traits::InputIter>::position::<_> Unexecuted instantiation: <&[u8; 1] as nom::traits::InputIter>::position::<_> Unexecuted instantiation: <&[u8; 2] as nom::traits::InputIter>::position::<_> Unexecuted instantiation: <&[u8; 3] as nom::traits::InputIter>::position::<_> Unexecuted instantiation: <&[u8; 8] as nom::traits::InputIter>::position::<_> Unexecuted instantiation: <&[u8; 13] as nom::traits::InputIter>::position::<_> Unexecuted instantiation: <&[u8; 14] as nom::traits::InputIter>::position::<_> Unexecuted instantiation: <&[u8; 15] as nom::traits::InputIter>::position::<_> Unexecuted instantiation: <&[u8; 9] as nom::traits::InputIter>::position::<_> Unexecuted instantiation: <&[u8; 10] as nom::traits::InputIter>::position::<_> Unexecuted instantiation: <&[u8; 11] as nom::traits::InputIter>::position::<_> Unexecuted instantiation: <&[u8; 12] as nom::traits::InputIter>::position::<_> Unexecuted instantiation: <&[u8; 16] as nom::traits::InputIter>::position::<_> Unexecuted instantiation: <&[u8; 17] as nom::traits::InputIter>::position::<_> Unexecuted instantiation: <&[u8; 22] as nom::traits::InputIter>::position::<_> Unexecuted instantiation: <&[u8; 23] as nom::traits::InputIter>::position::<_> Unexecuted instantiation: <&[u8; 24] as nom::traits::InputIter>::position::<_> Unexecuted instantiation: <&[u8; 18] as nom::traits::InputIter>::position::<_> Unexecuted instantiation: <&[u8; 19] as nom::traits::InputIter>::position::<_> Unexecuted instantiation: <&[u8; 20] as nom::traits::InputIter>::position::<_> Unexecuted instantiation: <&[u8; 21] as nom::traits::InputIter>::position::<_> Unexecuted instantiation: <&[u8; 25] as nom::traits::InputIter>::position::<_> Unexecuted instantiation: <&[u8; 26] as nom::traits::InputIter>::position::<_> Unexecuted instantiation: <&[u8; 30] as nom::traits::InputIter>::position::<_> Unexecuted instantiation: <&[u8; 31] as nom::traits::InputIter>::position::<_> Unexecuted instantiation: <&[u8; 32] as nom::traits::InputIter>::position::<_> Unexecuted instantiation: <&[u8; 27] as nom::traits::InputIter>::position::<_> Unexecuted instantiation: <&[u8; 28] as nom::traits::InputIter>::position::<_> Unexecuted instantiation: <&[u8; 29] as nom::traits::InputIter>::position::<_> |
1084 | | |
1085 | 0 | fn slice_index(&self, count: usize) -> Result<usize, Needed> { |
1086 | 0 | (&self[..]).slice_index(count) |
1087 | 0 | } Unexecuted instantiation: <&[u8; 4] as nom::traits::InputIter>::slice_index Unexecuted instantiation: <&[u8; 5] as nom::traits::InputIter>::slice_index Unexecuted instantiation: <&[u8; 6] as nom::traits::InputIter>::slice_index Unexecuted instantiation: <&[u8; 7] as nom::traits::InputIter>::slice_index Unexecuted instantiation: <&[u8; 0] as nom::traits::InputIter>::slice_index Unexecuted instantiation: <&[u8; 1] as nom::traits::InputIter>::slice_index Unexecuted instantiation: <&[u8; 2] as nom::traits::InputIter>::slice_index Unexecuted instantiation: <&[u8; 3] as nom::traits::InputIter>::slice_index Unexecuted instantiation: <&[u8; 8] as nom::traits::InputIter>::slice_index Unexecuted instantiation: <&[u8; 13] as nom::traits::InputIter>::slice_index Unexecuted instantiation: <&[u8; 14] as nom::traits::InputIter>::slice_index Unexecuted instantiation: <&[u8; 15] as nom::traits::InputIter>::slice_index Unexecuted instantiation: <&[u8; 9] as nom::traits::InputIter>::slice_index Unexecuted instantiation: <&[u8; 10] as nom::traits::InputIter>::slice_index Unexecuted instantiation: <&[u8; 11] as nom::traits::InputIter>::slice_index Unexecuted instantiation: <&[u8; 12] as nom::traits::InputIter>::slice_index Unexecuted instantiation: <&[u8; 16] as nom::traits::InputIter>::slice_index Unexecuted instantiation: <&[u8; 17] as nom::traits::InputIter>::slice_index Unexecuted instantiation: <&[u8; 22] as nom::traits::InputIter>::slice_index Unexecuted instantiation: <&[u8; 23] as nom::traits::InputIter>::slice_index Unexecuted instantiation: <&[u8; 24] as nom::traits::InputIter>::slice_index Unexecuted instantiation: <&[u8; 18] as nom::traits::InputIter>::slice_index Unexecuted instantiation: <&[u8; 19] as nom::traits::InputIter>::slice_index Unexecuted instantiation: <&[u8; 20] as nom::traits::InputIter>::slice_index Unexecuted instantiation: <&[u8; 21] as nom::traits::InputIter>::slice_index Unexecuted instantiation: <&[u8; 25] as nom::traits::InputIter>::slice_index Unexecuted instantiation: <&[u8; 26] as nom::traits::InputIter>::slice_index Unexecuted instantiation: <&[u8; 30] as nom::traits::InputIter>::slice_index Unexecuted instantiation: <&[u8; 31] as nom::traits::InputIter>::slice_index Unexecuted instantiation: <&[u8; 32] as nom::traits::InputIter>::slice_index Unexecuted instantiation: <&[u8; 27] as nom::traits::InputIter>::slice_index Unexecuted instantiation: <&[u8; 28] as nom::traits::InputIter>::slice_index Unexecuted instantiation: <&[u8; 29] as nom::traits::InputIter>::slice_index Unexecuted instantiation: <&[u8; 4] as nom::traits::InputIter>::slice_index Unexecuted instantiation: <&[u8; 5] as nom::traits::InputIter>::slice_index Unexecuted instantiation: <&[u8; 6] as nom::traits::InputIter>::slice_index Unexecuted instantiation: <&[u8; 7] as nom::traits::InputIter>::slice_index Unexecuted instantiation: <&[u8; 0] as nom::traits::InputIter>::slice_index Unexecuted instantiation: <&[u8; 1] as nom::traits::InputIter>::slice_index Unexecuted instantiation: <&[u8; 2] as nom::traits::InputIter>::slice_index Unexecuted instantiation: <&[u8; 3] as nom::traits::InputIter>::slice_index Unexecuted instantiation: <&[u8; 8] as nom::traits::InputIter>::slice_index Unexecuted instantiation: <&[u8; 13] as nom::traits::InputIter>::slice_index Unexecuted instantiation: <&[u8; 14] as nom::traits::InputIter>::slice_index Unexecuted instantiation: <&[u8; 15] as nom::traits::InputIter>::slice_index Unexecuted instantiation: <&[u8; 9] as nom::traits::InputIter>::slice_index Unexecuted instantiation: <&[u8; 10] as nom::traits::InputIter>::slice_index Unexecuted instantiation: <&[u8; 11] as nom::traits::InputIter>::slice_index Unexecuted instantiation: <&[u8; 12] as nom::traits::InputIter>::slice_index Unexecuted instantiation: <&[u8; 16] as nom::traits::InputIter>::slice_index Unexecuted instantiation: <&[u8; 17] as nom::traits::InputIter>::slice_index Unexecuted instantiation: <&[u8; 22] as nom::traits::InputIter>::slice_index Unexecuted instantiation: <&[u8; 23] as nom::traits::InputIter>::slice_index Unexecuted instantiation: <&[u8; 24] as nom::traits::InputIter>::slice_index Unexecuted instantiation: <&[u8; 18] as nom::traits::InputIter>::slice_index Unexecuted instantiation: <&[u8; 19] as nom::traits::InputIter>::slice_index Unexecuted instantiation: <&[u8; 20] as nom::traits::InputIter>::slice_index Unexecuted instantiation: <&[u8; 21] as nom::traits::InputIter>::slice_index Unexecuted instantiation: <&[u8; 25] as nom::traits::InputIter>::slice_index Unexecuted instantiation: <&[u8; 26] as nom::traits::InputIter>::slice_index Unexecuted instantiation: <&[u8; 30] as nom::traits::InputIter>::slice_index Unexecuted instantiation: <&[u8; 31] as nom::traits::InputIter>::slice_index Unexecuted instantiation: <&[u8; 32] as nom::traits::InputIter>::slice_index Unexecuted instantiation: <&[u8; 27] as nom::traits::InputIter>::slice_index Unexecuted instantiation: <&[u8; 28] as nom::traits::InputIter>::slice_index Unexecuted instantiation: <&[u8; 29] as nom::traits::InputIter>::slice_index |
1088 | | } |
1089 | | |
1090 | | impl<'a> Compare<[u8; $N]> for &'a [u8] { |
1091 | | #[inline(always)] |
1092 | 957k | fn compare(&self, t: [u8; $N]) -> CompareResult { |
1093 | 957k | self.compare(&t[..]) |
1094 | 957k | } Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 2]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 4]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 5]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 6]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 0]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 1]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 3]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 7]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 8]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 13]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 14]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 15]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 9]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 10]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 11]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 12]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 16]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 17]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 21]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 22]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 23]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 24]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 18]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 19]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 20]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 25]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 26]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 30]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 31]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 32]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 27]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 28]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 29]>>::compare <&[u8] as nom::traits::Compare<[u8; 1]>>::compare Line | Count | Source | 1092 | 957k | fn compare(&self, t: [u8; $N]) -> CompareResult { | 1093 | 957k | self.compare(&t[..]) | 1094 | 957k | } |
Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 2]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 4]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 5]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 6]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 0]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 3]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 7]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 8]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 13]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 14]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 15]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 9]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 10]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 11]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 12]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 16]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 17]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 21]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 22]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 23]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 24]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 18]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 19]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 20]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 25]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 26]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 30]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 31]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 32]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 27]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 28]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 29]>>::compare |
1095 | | |
1096 | | #[inline(always)] |
1097 | 0 | fn compare_no_case(&self, t: [u8;$N]) -> CompareResult { |
1098 | 0 | self.compare_no_case(&t[..]) |
1099 | 0 | } Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 4]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 5]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 6]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 0]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 1]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 2]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 3]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 7]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 8]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 13]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 14]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 15]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 9]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 10]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 11]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 12]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 16]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 17]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 21]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 22]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 23]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 24]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 18]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 19]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 20]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 25]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 26]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 30]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 31]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 32]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 27]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 28]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 29]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 4]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 5]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 6]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 0]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 1]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 2]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 3]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 7]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 8]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 13]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 14]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 15]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 9]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 10]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 11]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 12]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 16]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 17]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 21]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 22]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 23]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 24]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 18]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 19]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 20]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 25]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 26]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 30]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 31]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 32]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 27]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 28]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<[u8; 29]>>::compare_no_case |
1100 | | } |
1101 | | |
1102 | | impl<'a,'b> Compare<&'b [u8; $N]> for &'a [u8] { |
1103 | | #[inline(always)] |
1104 | 5.87M | fn compare(&self, t: &'b [u8; $N]) -> CompareResult { |
1105 | 5.87M | self.compare(&t[..]) |
1106 | 5.87M | } <&[u8] as nom::traits::Compare<&[u8; 4]>>::compare Line | Count | Source | 1104 | 9.69k | fn compare(&self, t: &'b [u8; $N]) -> CompareResult { | 1105 | 9.69k | self.compare(&t[..]) | 1106 | 9.69k | } |
Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 5]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 6]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 0]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 1]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 2]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 3]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 7]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 8]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 12]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 13]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 14]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 15]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 9]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 10]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 11]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 16]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 17]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 21]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 22]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 23]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 24]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 18]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 19]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 20]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 25]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 30]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 31]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 32]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 26]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 27]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 28]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 29]>>::compare <&[u8] as nom::traits::Compare<&[u8; 8]>>::compare Line | Count | Source | 1104 | 73.7k | fn compare(&self, t: &'b [u8; $N]) -> CompareResult { | 1105 | 73.7k | self.compare(&t[..]) | 1106 | 73.7k | } |
<&[u8] as nom::traits::Compare<&[u8; 9]>>::compare Line | Count | Source | 1104 | 1.21k | fn compare(&self, t: &'b [u8; $N]) -> CompareResult { | 1105 | 1.21k | self.compare(&t[..]) | 1106 | 1.21k | } |
<&[u8] as nom::traits::Compare<&[u8; 1]>>::compare Line | Count | Source | 1104 | 200k | fn compare(&self, t: &'b [u8; $N]) -> CompareResult { | 1105 | 200k | self.compare(&t[..]) | 1106 | 200k | } |
<&[u8] as nom::traits::Compare<&[u8; 3]>>::compare Line | Count | Source | 1104 | 2.78M | fn compare(&self, t: &'b [u8; $N]) -> CompareResult { | 1105 | 2.78M | self.compare(&t[..]) | 1106 | 2.78M | } |
<&[u8] as nom::traits::Compare<&[u8; 4]>>::compare Line | Count | Source | 1104 | 2.79M | fn compare(&self, t: &'b [u8; $N]) -> CompareResult { | 1105 | 2.79M | self.compare(&t[..]) | 1106 | 2.79M | } |
Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 5]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 6]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 0]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 2]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 7]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 12]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 13]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 14]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 15]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 10]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 11]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 16]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 17]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 21]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 22]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 23]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 24]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 18]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 19]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 20]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 25]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 30]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 31]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 32]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 26]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 27]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 28]>>::compare Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 29]>>::compare |
1107 | | |
1108 | | #[inline(always)] |
1109 | 0 | fn compare_no_case(&self, t: &'b [u8;$N]) -> CompareResult { |
1110 | 0 | self.compare_no_case(&t[..]) |
1111 | 0 | } Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 4]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 5]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 6]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 0]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 1]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 2]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 3]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 7]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 8]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 12]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 13]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 14]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 15]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 9]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 10]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 11]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 16]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 17]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 21]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 22]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 23]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 24]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 18]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 19]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 20]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 25]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 30]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 31]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 32]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 26]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 27]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 28]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 29]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 4]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 5]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 6]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 0]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 1]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 2]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 3]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 7]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 8]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 12]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 13]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 14]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 15]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 9]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 10]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 11]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 16]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 17]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 21]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 22]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 23]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 24]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 18]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 19]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 20]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 25]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 30]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 31]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 32]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 26]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 27]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 28]>>::compare_no_case Unexecuted instantiation: <&[u8] as nom::traits::Compare<&[u8; 29]>>::compare_no_case |
1112 | | } |
1113 | | |
1114 | | impl FindToken<u8> for [u8; $N] { |
1115 | 0 | fn find_token(&self, token: u8) -> bool { |
1116 | 0 | memchr::memchr(token, &self[..]).is_some() |
1117 | 0 | } Unexecuted instantiation: <[u8; 3] as nom::traits::FindToken<u8>>::find_token Unexecuted instantiation: <[u8; 4] as nom::traits::FindToken<u8>>::find_token Unexecuted instantiation: <[u8; 5] as nom::traits::FindToken<u8>>::find_token Unexecuted instantiation: <[u8; 6] as nom::traits::FindToken<u8>>::find_token Unexecuted instantiation: <[u8; 0] as nom::traits::FindToken<u8>>::find_token Unexecuted instantiation: <[u8; 1] as nom::traits::FindToken<u8>>::find_token Unexecuted instantiation: <[u8; 2] as nom::traits::FindToken<u8>>::find_token Unexecuted instantiation: <[u8; 7] as nom::traits::FindToken<u8>>::find_token Unexecuted instantiation: <[u8; 8] as nom::traits::FindToken<u8>>::find_token Unexecuted instantiation: <[u8; 12] as nom::traits::FindToken<u8>>::find_token Unexecuted instantiation: <[u8; 13] as nom::traits::FindToken<u8>>::find_token Unexecuted instantiation: <[u8; 14] as nom::traits::FindToken<u8>>::find_token Unexecuted instantiation: <[u8; 15] as nom::traits::FindToken<u8>>::find_token Unexecuted instantiation: <[u8; 9] as nom::traits::FindToken<u8>>::find_token Unexecuted instantiation: <[u8; 10] as nom::traits::FindToken<u8>>::find_token Unexecuted instantiation: <[u8; 11] as nom::traits::FindToken<u8>>::find_token Unexecuted instantiation: <[u8; 16] as nom::traits::FindToken<u8>>::find_token Unexecuted instantiation: <[u8; 21] as nom::traits::FindToken<u8>>::find_token Unexecuted instantiation: <[u8; 22] as nom::traits::FindToken<u8>>::find_token Unexecuted instantiation: <[u8; 23] as nom::traits::FindToken<u8>>::find_token Unexecuted instantiation: <[u8; 24] as nom::traits::FindToken<u8>>::find_token Unexecuted instantiation: <[u8; 17] as nom::traits::FindToken<u8>>::find_token Unexecuted instantiation: <[u8; 18] as nom::traits::FindToken<u8>>::find_token Unexecuted instantiation: <[u8; 19] as nom::traits::FindToken<u8>>::find_token Unexecuted instantiation: <[u8; 20] as nom::traits::FindToken<u8>>::find_token Unexecuted instantiation: <[u8; 25] as nom::traits::FindToken<u8>>::find_token Unexecuted instantiation: <[u8; 30] as nom::traits::FindToken<u8>>::find_token Unexecuted instantiation: <[u8; 31] as nom::traits::FindToken<u8>>::find_token Unexecuted instantiation: <[u8; 32] as nom::traits::FindToken<u8>>::find_token Unexecuted instantiation: <[u8; 26] as nom::traits::FindToken<u8>>::find_token Unexecuted instantiation: <[u8; 27] as nom::traits::FindToken<u8>>::find_token Unexecuted instantiation: <[u8; 28] as nom::traits::FindToken<u8>>::find_token Unexecuted instantiation: <[u8; 29] as nom::traits::FindToken<u8>>::find_token Unexecuted instantiation: <[u8; 3] as nom::traits::FindToken<u8>>::find_token Unexecuted instantiation: <[u8; 4] as nom::traits::FindToken<u8>>::find_token Unexecuted instantiation: <[u8; 5] as nom::traits::FindToken<u8>>::find_token Unexecuted instantiation: <[u8; 6] as nom::traits::FindToken<u8>>::find_token Unexecuted instantiation: <[u8; 1] as nom::traits::FindToken<u8>>::find_token Unexecuted instantiation: <[u8; 2] as nom::traits::FindToken<u8>>::find_token Unexecuted instantiation: <[u8; 7] as nom::traits::FindToken<u8>>::find_token Unexecuted instantiation: <[u8; 8] as nom::traits::FindToken<u8>>::find_token Unexecuted instantiation: <[u8; 12] as nom::traits::FindToken<u8>>::find_token Unexecuted instantiation: <[u8; 13] as nom::traits::FindToken<u8>>::find_token Unexecuted instantiation: <[u8; 14] as nom::traits::FindToken<u8>>::find_token Unexecuted instantiation: <[u8; 15] as nom::traits::FindToken<u8>>::find_token Unexecuted instantiation: <[u8; 9] as nom::traits::FindToken<u8>>::find_token Unexecuted instantiation: <[u8; 10] as nom::traits::FindToken<u8>>::find_token Unexecuted instantiation: <[u8; 11] as nom::traits::FindToken<u8>>::find_token Unexecuted instantiation: <[u8; 16] as nom::traits::FindToken<u8>>::find_token Unexecuted instantiation: <[u8; 21] as nom::traits::FindToken<u8>>::find_token Unexecuted instantiation: <[u8; 22] as nom::traits::FindToken<u8>>::find_token Unexecuted instantiation: <[u8; 23] as nom::traits::FindToken<u8>>::find_token Unexecuted instantiation: <[u8; 24] as nom::traits::FindToken<u8>>::find_token Unexecuted instantiation: <[u8; 17] as nom::traits::FindToken<u8>>::find_token Unexecuted instantiation: <[u8; 18] as nom::traits::FindToken<u8>>::find_token Unexecuted instantiation: <[u8; 19] as nom::traits::FindToken<u8>>::find_token Unexecuted instantiation: <[u8; 20] as nom::traits::FindToken<u8>>::find_token Unexecuted instantiation: <[u8; 25] as nom::traits::FindToken<u8>>::find_token Unexecuted instantiation: <[u8; 30] as nom::traits::FindToken<u8>>::find_token Unexecuted instantiation: <[u8; 31] as nom::traits::FindToken<u8>>::find_token Unexecuted instantiation: <[u8; 32] as nom::traits::FindToken<u8>>::find_token Unexecuted instantiation: <[u8; 26] as nom::traits::FindToken<u8>>::find_token Unexecuted instantiation: <[u8; 27] as nom::traits::FindToken<u8>>::find_token Unexecuted instantiation: <[u8; 28] as nom::traits::FindToken<u8>>::find_token Unexecuted instantiation: <[u8; 29] as nom::traits::FindToken<u8>>::find_token Unexecuted instantiation: <[u8; 0] as nom::traits::FindToken<u8>>::find_token |
1118 | | } |
1119 | | |
1120 | | impl<'a> FindToken<&'a u8> for [u8; $N] { |
1121 | 0 | fn find_token(&self, token: &u8) -> bool { |
1122 | 0 | self.find_token(*token) |
1123 | 0 | } Unexecuted instantiation: <[u8; 3] as nom::traits::FindToken<&u8>>::find_token Unexecuted instantiation: <[u8; 4] as nom::traits::FindToken<&u8>>::find_token Unexecuted instantiation: <[u8; 5] as nom::traits::FindToken<&u8>>::find_token Unexecuted instantiation: <[u8; 6] as nom::traits::FindToken<&u8>>::find_token Unexecuted instantiation: <[u8; 0] as nom::traits::FindToken<&u8>>::find_token Unexecuted instantiation: <[u8; 1] as nom::traits::FindToken<&u8>>::find_token Unexecuted instantiation: <[u8; 2] as nom::traits::FindToken<&u8>>::find_token Unexecuted instantiation: <[u8; 7] as nom::traits::FindToken<&u8>>::find_token Unexecuted instantiation: <[u8; 12] as nom::traits::FindToken<&u8>>::find_token Unexecuted instantiation: <[u8; 13] as nom::traits::FindToken<&u8>>::find_token Unexecuted instantiation: <[u8; 14] as nom::traits::FindToken<&u8>>::find_token Unexecuted instantiation: <[u8; 15] as nom::traits::FindToken<&u8>>::find_token Unexecuted instantiation: <[u8; 8] as nom::traits::FindToken<&u8>>::find_token Unexecuted instantiation: <[u8; 9] as nom::traits::FindToken<&u8>>::find_token Unexecuted instantiation: <[u8; 10] as nom::traits::FindToken<&u8>>::find_token Unexecuted instantiation: <[u8; 11] as nom::traits::FindToken<&u8>>::find_token Unexecuted instantiation: <[u8; 16] as nom::traits::FindToken<&u8>>::find_token Unexecuted instantiation: <[u8; 21] as nom::traits::FindToken<&u8>>::find_token Unexecuted instantiation: <[u8; 22] as nom::traits::FindToken<&u8>>::find_token Unexecuted instantiation: <[u8; 23] as nom::traits::FindToken<&u8>>::find_token Unexecuted instantiation: <[u8; 24] as nom::traits::FindToken<&u8>>::find_token Unexecuted instantiation: <[u8; 17] as nom::traits::FindToken<&u8>>::find_token Unexecuted instantiation: <[u8; 18] as nom::traits::FindToken<&u8>>::find_token Unexecuted instantiation: <[u8; 19] as nom::traits::FindToken<&u8>>::find_token Unexecuted instantiation: <[u8; 20] as nom::traits::FindToken<&u8>>::find_token Unexecuted instantiation: <[u8; 25] as nom::traits::FindToken<&u8>>::find_token Unexecuted instantiation: <[u8; 30] as nom::traits::FindToken<&u8>>::find_token Unexecuted instantiation: <[u8; 31] as nom::traits::FindToken<&u8>>::find_token Unexecuted instantiation: <[u8; 32] as nom::traits::FindToken<&u8>>::find_token Unexecuted instantiation: <[u8; 26] as nom::traits::FindToken<&u8>>::find_token Unexecuted instantiation: <[u8; 27] as nom::traits::FindToken<&u8>>::find_token Unexecuted instantiation: <[u8; 28] as nom::traits::FindToken<&u8>>::find_token Unexecuted instantiation: <[u8; 29] as nom::traits::FindToken<&u8>>::find_token Unexecuted instantiation: <[u8; 3] as nom::traits::FindToken<&u8>>::find_token Unexecuted instantiation: <[u8; 4] as nom::traits::FindToken<&u8>>::find_token Unexecuted instantiation: <[u8; 5] as nom::traits::FindToken<&u8>>::find_token Unexecuted instantiation: <[u8; 6] as nom::traits::FindToken<&u8>>::find_token Unexecuted instantiation: <[u8; 1] as nom::traits::FindToken<&u8>>::find_token Unexecuted instantiation: <[u8; 2] as nom::traits::FindToken<&u8>>::find_token Unexecuted instantiation: <[u8; 7] as nom::traits::FindToken<&u8>>::find_token Unexecuted instantiation: <[u8; 12] as nom::traits::FindToken<&u8>>::find_token Unexecuted instantiation: <[u8; 13] as nom::traits::FindToken<&u8>>::find_token Unexecuted instantiation: <[u8; 14] as nom::traits::FindToken<&u8>>::find_token Unexecuted instantiation: <[u8; 15] as nom::traits::FindToken<&u8>>::find_token Unexecuted instantiation: <[u8; 8] as nom::traits::FindToken<&u8>>::find_token Unexecuted instantiation: <[u8; 9] as nom::traits::FindToken<&u8>>::find_token Unexecuted instantiation: <[u8; 10] as nom::traits::FindToken<&u8>>::find_token Unexecuted instantiation: <[u8; 11] as nom::traits::FindToken<&u8>>::find_token Unexecuted instantiation: <[u8; 16] as nom::traits::FindToken<&u8>>::find_token Unexecuted instantiation: <[u8; 21] as nom::traits::FindToken<&u8>>::find_token Unexecuted instantiation: <[u8; 22] as nom::traits::FindToken<&u8>>::find_token Unexecuted instantiation: <[u8; 23] as nom::traits::FindToken<&u8>>::find_token Unexecuted instantiation: <[u8; 24] as nom::traits::FindToken<&u8>>::find_token Unexecuted instantiation: <[u8; 17] as nom::traits::FindToken<&u8>>::find_token Unexecuted instantiation: <[u8; 18] as nom::traits::FindToken<&u8>>::find_token Unexecuted instantiation: <[u8; 19] as nom::traits::FindToken<&u8>>::find_token Unexecuted instantiation: <[u8; 20] as nom::traits::FindToken<&u8>>::find_token Unexecuted instantiation: <[u8; 25] as nom::traits::FindToken<&u8>>::find_token Unexecuted instantiation: <[u8; 30] as nom::traits::FindToken<&u8>>::find_token Unexecuted instantiation: <[u8; 31] as nom::traits::FindToken<&u8>>::find_token Unexecuted instantiation: <[u8; 32] as nom::traits::FindToken<&u8>>::find_token Unexecuted instantiation: <[u8; 26] as nom::traits::FindToken<&u8>>::find_token Unexecuted instantiation: <[u8; 27] as nom::traits::FindToken<&u8>>::find_token Unexecuted instantiation: <[u8; 28] as nom::traits::FindToken<&u8>>::find_token Unexecuted instantiation: <[u8; 29] as nom::traits::FindToken<&u8>>::find_token Unexecuted instantiation: <[u8; 0] as nom::traits::FindToken<&u8>>::find_token |
1124 | | } |
1125 | | )+ |
1126 | | }; |
1127 | | } |
1128 | | |
1129 | | array_impls! { |
1130 | | 0 1 2 3 4 5 6 7 8 9 |
1131 | | 10 11 12 13 14 15 16 17 18 19 |
1132 | | 20 21 22 23 24 25 26 27 28 29 |
1133 | | 30 31 32 |
1134 | | } |
1135 | | |
1136 | | /// Abstracts something which can extend an `Extend`. |
1137 | | /// Used to build modified input slices in `escaped_transform` |
1138 | | pub trait ExtendInto { |
1139 | | /// The current input type is a sequence of that `Item` type. |
1140 | | /// |
1141 | | /// Example: `u8` for `&[u8]` or `char` for `&str` |
1142 | | type Item; |
1143 | | |
1144 | | /// The type that will be produced |
1145 | | type Extender; |
1146 | | |
1147 | | /// Create a new `Extend` of the correct type |
1148 | | fn new_builder(&self) -> Self::Extender; |
1149 | | /// Accumulate the input into an accumulator |
1150 | | fn extend_into(&self, acc: &mut Self::Extender); |
1151 | | } |
1152 | | |
1153 | | #[cfg(feature = "alloc")] |
1154 | | impl ExtendInto for [u8] { |
1155 | | type Item = u8; |
1156 | | type Extender = Vec<u8>; |
1157 | | |
1158 | | #[inline] |
1159 | 0 | fn new_builder(&self) -> Vec<u8> { |
1160 | 0 | Vec::new() |
1161 | 0 | } Unexecuted instantiation: <[u8] as nom::traits::ExtendInto>::new_builder Unexecuted instantiation: <[u8] as nom::traits::ExtendInto>::new_builder |
1162 | | #[inline] |
1163 | 0 | fn extend_into(&self, acc: &mut Vec<u8>) { |
1164 | 0 | acc.extend(self.iter().cloned()); |
1165 | 0 | } Unexecuted instantiation: <[u8] as nom::traits::ExtendInto>::extend_into Unexecuted instantiation: <[u8] as nom::traits::ExtendInto>::extend_into |
1166 | | } |
1167 | | |
1168 | | #[cfg(feature = "alloc")] |
1169 | | impl ExtendInto for &[u8] { |
1170 | | type Item = u8; |
1171 | | type Extender = Vec<u8>; |
1172 | | |
1173 | | #[inline] |
1174 | 0 | fn new_builder(&self) -> Vec<u8> { |
1175 | 0 | Vec::new() |
1176 | 0 | } Unexecuted instantiation: <&[u8] as nom::traits::ExtendInto>::new_builder Unexecuted instantiation: <&[u8] as nom::traits::ExtendInto>::new_builder |
1177 | | #[inline] |
1178 | 0 | fn extend_into(&self, acc: &mut Vec<u8>) { |
1179 | 0 | acc.extend_from_slice(self); |
1180 | 0 | } Unexecuted instantiation: <&[u8] as nom::traits::ExtendInto>::extend_into Unexecuted instantiation: <&[u8] as nom::traits::ExtendInto>::extend_into |
1181 | | } |
1182 | | |
1183 | | #[cfg(feature = "alloc")] |
1184 | | impl ExtendInto for str { |
1185 | | type Item = char; |
1186 | | type Extender = String; |
1187 | | |
1188 | | #[inline] |
1189 | 0 | fn new_builder(&self) -> String { |
1190 | 0 | String::new() |
1191 | 0 | } Unexecuted instantiation: <str as nom::traits::ExtendInto>::new_builder Unexecuted instantiation: <str as nom::traits::ExtendInto>::new_builder |
1192 | | #[inline] |
1193 | 0 | fn extend_into(&self, acc: &mut String) { |
1194 | 0 | acc.push_str(self); |
1195 | 0 | } Unexecuted instantiation: <str as nom::traits::ExtendInto>::extend_into Unexecuted instantiation: <str as nom::traits::ExtendInto>::extend_into |
1196 | | } |
1197 | | |
1198 | | #[cfg(feature = "alloc")] |
1199 | | impl ExtendInto for &str { |
1200 | | type Item = char; |
1201 | | type Extender = String; |
1202 | | |
1203 | | #[inline] |
1204 | 0 | fn new_builder(&self) -> String { |
1205 | 0 | String::new() |
1206 | 0 | } Unexecuted instantiation: <&str as nom::traits::ExtendInto>::new_builder Unexecuted instantiation: <&str as nom::traits::ExtendInto>::new_builder |
1207 | | #[inline] |
1208 | 0 | fn extend_into(&self, acc: &mut String) { |
1209 | 0 | acc.push_str(self); |
1210 | 0 | } Unexecuted instantiation: <&str as nom::traits::ExtendInto>::extend_into Unexecuted instantiation: <&str as nom::traits::ExtendInto>::extend_into |
1211 | | } |
1212 | | |
1213 | | #[cfg(feature = "alloc")] |
1214 | | impl ExtendInto for char { |
1215 | | type Item = char; |
1216 | | type Extender = String; |
1217 | | |
1218 | | #[inline] |
1219 | 0 | fn new_builder(&self) -> String { |
1220 | 0 | String::new() |
1221 | 0 | } Unexecuted instantiation: <char as nom::traits::ExtendInto>::new_builder Unexecuted instantiation: <char as nom::traits::ExtendInto>::new_builder |
1222 | | #[inline] |
1223 | 0 | fn extend_into(&self, acc: &mut String) { |
1224 | 0 | acc.push(*self); |
1225 | 0 | } Unexecuted instantiation: <char as nom::traits::ExtendInto>::extend_into Unexecuted instantiation: <char as nom::traits::ExtendInto>::extend_into |
1226 | | } |
1227 | | |
1228 | | /// Helper trait to convert numbers to usize. |
1229 | | /// |
1230 | | /// By default, usize implements `From<u8>` and `From<u16>` but not |
1231 | | /// `From<u32>` and `From<u64>` because that would be invalid on some |
1232 | | /// platforms. This trait implements the conversion for platforms |
1233 | | /// with 32 and 64 bits pointer platforms |
1234 | | pub trait ToUsize { |
1235 | | /// converts self to usize |
1236 | | fn to_usize(&self) -> usize; |
1237 | | } |
1238 | | |
1239 | | impl ToUsize for u8 { |
1240 | | #[inline] |
1241 | 394M | fn to_usize(&self) -> usize { |
1242 | 394M | *self as usize |
1243 | 394M | } <u8 as nom::traits::ToUsize>::to_usize Line | Count | Source | 1241 | 136M | fn to_usize(&self) -> usize { | 1242 | 136M | *self as usize | 1243 | 136M | } |
<u8 as nom::traits::ToUsize>::to_usize Line | Count | Source | 1241 | 257M | fn to_usize(&self) -> usize { | 1242 | 257M | *self as usize | 1243 | 257M | } |
|
1244 | | } |
1245 | | |
1246 | | impl ToUsize for u16 { |
1247 | | #[inline] |
1248 | 30.7M | fn to_usize(&self) -> usize { |
1249 | 30.7M | *self as usize |
1250 | 30.7M | } <u16 as nom::traits::ToUsize>::to_usize Line | Count | Source | 1248 | 10.0M | fn to_usize(&self) -> usize { | 1249 | 10.0M | *self as usize | 1250 | 10.0M | } |
<u16 as nom::traits::ToUsize>::to_usize Line | Count | Source | 1248 | 20.7M | fn to_usize(&self) -> usize { | 1249 | 20.7M | *self as usize | 1250 | 20.7M | } |
|
1251 | | } |
1252 | | |
1253 | | impl ToUsize for usize { |
1254 | | #[inline] |
1255 | 101M | fn to_usize(&self) -> usize { |
1256 | 101M | *self |
1257 | 101M | } <usize as nom::traits::ToUsize>::to_usize Line | Count | Source | 1255 | 40.1M | fn to_usize(&self) -> usize { | 1256 | 40.1M | *self | 1257 | 40.1M | } |
<usize as nom::traits::ToUsize>::to_usize Line | Count | Source | 1255 | 61.1M | fn to_usize(&self) -> usize { | 1256 | 61.1M | *self | 1257 | 61.1M | } |
|
1258 | | } |
1259 | | |
1260 | | #[cfg(any(target_pointer_width = "32", target_pointer_width = "64"))] |
1261 | | impl ToUsize for u32 { |
1262 | | #[inline] |
1263 | 228M | fn to_usize(&self) -> usize { |
1264 | 228M | *self as usize |
1265 | 228M | } <u32 as nom::traits::ToUsize>::to_usize Line | Count | Source | 1263 | 137M | fn to_usize(&self) -> usize { | 1264 | 137M | *self as usize | 1265 | 137M | } |
<u32 as nom::traits::ToUsize>::to_usize Line | Count | Source | 1263 | 90.9M | fn to_usize(&self) -> usize { | 1264 | 90.9M | *self as usize | 1265 | 90.9M | } |
|
1266 | | } |
1267 | | |
1268 | | #[cfg(target_pointer_width = "64")] |
1269 | | impl ToUsize for u64 { |
1270 | | #[inline] |
1271 | 0 | fn to_usize(&self) -> usize { |
1272 | 0 | *self as usize |
1273 | 0 | } Unexecuted instantiation: <u64 as nom::traits::ToUsize>::to_usize Unexecuted instantiation: <u64 as nom::traits::ToUsize>::to_usize |
1274 | | } |
1275 | | |
1276 | | /// Equivalent From implementation to avoid orphan rules in bits parsers |
1277 | | pub trait ErrorConvert<E> { |
1278 | | /// Transform to another error type |
1279 | | fn convert(self) -> E; |
1280 | | } |
1281 | | |
1282 | | impl<I> ErrorConvert<(I, ErrorKind)> for ((I, usize), ErrorKind) { |
1283 | 0 | fn convert(self) -> (I, ErrorKind) { |
1284 | 0 | ((self.0).0, self.1) |
1285 | 0 | } Unexecuted instantiation: <((_, usize), nom::error::ErrorKind) as nom::traits::ErrorConvert<(_, nom::error::ErrorKind)>>::convert Unexecuted instantiation: <((_, usize), nom::error::ErrorKind) as nom::traits::ErrorConvert<(_, nom::error::ErrorKind)>>::convert |
1286 | | } |
1287 | | |
1288 | | impl<I> ErrorConvert<((I, usize), ErrorKind)> for (I, ErrorKind) { |
1289 | 0 | fn convert(self) -> ((I, usize), ErrorKind) { |
1290 | 0 | ((self.0, 0), self.1) |
1291 | 0 | } Unexecuted instantiation: <(_, nom::error::ErrorKind) as nom::traits::ErrorConvert<((_, usize), nom::error::ErrorKind)>>::convert Unexecuted instantiation: <(_, nom::error::ErrorKind) as nom::traits::ErrorConvert<((_, usize), nom::error::ErrorKind)>>::convert |
1292 | | } |
1293 | | |
1294 | | use crate::error; |
1295 | | impl<I> ErrorConvert<error::Error<I>> for error::Error<(I, usize)> { |
1296 | 5.31k | fn convert(self) -> error::Error<I> { |
1297 | 5.31k | error::Error { |
1298 | 5.31k | input: self.input.0, |
1299 | 5.31k | code: self.code, |
1300 | 5.31k | } |
1301 | 5.31k | } Unexecuted instantiation: <nom::error::Error<(&[u8], usize)> as nom::traits::ErrorConvert<nom::error::Error<&[u8]>>>::convert Unexecuted instantiation: <nom::error::Error<(_, usize)> as nom::traits::ErrorConvert<nom::error::Error<_>>>::convert <nom::error::Error<(&[u8], usize)> as nom::traits::ErrorConvert<nom::error::Error<&[u8]>>>::convert Line | Count | Source | 1296 | 5.31k | fn convert(self) -> error::Error<I> { | 1297 | 5.31k | error::Error { | 1298 | 5.31k | input: self.input.0, | 1299 | 5.31k | code: self.code, | 1300 | 5.31k | } | 1301 | 5.31k | } |
Unexecuted instantiation: <nom::error::Error<(_, usize)> as nom::traits::ErrorConvert<nom::error::Error<_>>>::convert |
1302 | | } |
1303 | | |
1304 | | impl<I> ErrorConvert<error::Error<(I, usize)>> for error::Error<I> { |
1305 | 0 | fn convert(self) -> error::Error<(I, usize)> { |
1306 | 0 | error::Error { |
1307 | 0 | input: (self.input, 0), |
1308 | 0 | code: self.code, |
1309 | 0 | } |
1310 | 0 | } Unexecuted instantiation: <nom::error::Error<_> as nom::traits::ErrorConvert<nom::error::Error<(_, usize)>>>::convert Unexecuted instantiation: <nom::error::Error<_> as nom::traits::ErrorConvert<nom::error::Error<(_, usize)>>>::convert |
1311 | | } |
1312 | | |
1313 | | #[cfg(feature = "alloc")] |
1314 | | #[cfg_attr(feature = "docsrs", doc(cfg(feature = "alloc")))] |
1315 | | impl<I> ErrorConvert<error::VerboseError<I>> for error::VerboseError<(I, usize)> { |
1316 | 0 | fn convert(self) -> error::VerboseError<I> { |
1317 | | error::VerboseError { |
1318 | 0 | errors: self.errors.into_iter().map(|(i, e)| (i.0, e)).collect(), Unexecuted instantiation: <nom::error::VerboseError<(_, usize)> as nom::traits::ErrorConvert<nom::error::VerboseError<_>>>::convert::{closure#0}Unexecuted instantiation: <nom::error::VerboseError<(_, usize)> as nom::traits::ErrorConvert<nom::error::VerboseError<_>>>::convert::{closure#0} |
1319 | | } |
1320 | 0 | } Unexecuted instantiation: <nom::error::VerboseError<(_, usize)> as nom::traits::ErrorConvert<nom::error::VerboseError<_>>>::convert Unexecuted instantiation: <nom::error::VerboseError<(_, usize)> as nom::traits::ErrorConvert<nom::error::VerboseError<_>>>::convert |
1321 | | } |
1322 | | |
1323 | | #[cfg(feature = "alloc")] |
1324 | | #[cfg_attr(feature = "docsrs", doc(cfg(feature = "alloc")))] |
1325 | | impl<I> ErrorConvert<error::VerboseError<(I, usize)>> for error::VerboseError<I> { |
1326 | 0 | fn convert(self) -> error::VerboseError<(I, usize)> { |
1327 | | error::VerboseError { |
1328 | 0 | errors: self.errors.into_iter().map(|(i, e)| ((i, 0), e)).collect(), Unexecuted instantiation: <nom::error::VerboseError<_> as nom::traits::ErrorConvert<nom::error::VerboseError<(_, usize)>>>::convert::{closure#0}Unexecuted instantiation: <nom::error::VerboseError<_> as nom::traits::ErrorConvert<nom::error::VerboseError<(_, usize)>>>::convert::{closure#0} |
1329 | | } |
1330 | 0 | } Unexecuted instantiation: <nom::error::VerboseError<_> as nom::traits::ErrorConvert<nom::error::VerboseError<(_, usize)>>>::convert Unexecuted instantiation: <nom::error::VerboseError<_> as nom::traits::ErrorConvert<nom::error::VerboseError<(_, usize)>>>::convert |
1331 | | } |
1332 | | |
1333 | | impl ErrorConvert<()> for () { |
1334 | 0 | fn convert(self) {}Unexecuted instantiation: <() as nom::traits::ErrorConvert<()>>::convert Unexecuted instantiation: <() as nom::traits::ErrorConvert<()>>::convert |
1335 | | } |
1336 | | |
1337 | | #[cfg(feature = "std")] |
1338 | | #[cfg_attr(feature = "docsrs", doc(cfg(feature = "std")))] |
1339 | | /// Helper trait to show a byte slice as a hex dump |
1340 | | pub trait HexDisplay { |
1341 | | /// Converts the value of `self` to a hex dump, returning the owned |
1342 | | /// `String`. |
1343 | | fn to_hex(&self, chunk_size: usize) -> String; |
1344 | | |
1345 | | /// Converts the value of `self` to a hex dump beginning at `from` address, returning the owned |
1346 | | /// `String`. |
1347 | | fn to_hex_from(&self, chunk_size: usize, from: usize) -> String; |
1348 | | } |
1349 | | |
1350 | | #[cfg(feature = "std")] |
1351 | | static CHARS: &[u8] = b"0123456789abcdef"; |
1352 | | |
1353 | | #[cfg(feature = "std")] |
1354 | | impl HexDisplay for [u8] { |
1355 | | #[allow(unused_variables)] |
1356 | 0 | fn to_hex(&self, chunk_size: usize) -> String { |
1357 | 0 | self.to_hex_from(chunk_size, 0) |
1358 | 0 | } Unexecuted instantiation: <[u8] as nom::traits::HexDisplay>::to_hex Unexecuted instantiation: <[u8] as nom::traits::HexDisplay>::to_hex |
1359 | | |
1360 | | #[allow(unused_variables)] |
1361 | 0 | fn to_hex_from(&self, chunk_size: usize, from: usize) -> String { |
1362 | 0 | let mut v = Vec::with_capacity(self.len() * 3); |
1363 | 0 | let mut i = from; |
1364 | 0 | for chunk in self.chunks(chunk_size) { |
1365 | 0 | let s = format!("{:08x}", i); |
1366 | 0 | for &ch in s.as_bytes().iter() { |
1367 | 0 | v.push(ch); |
1368 | 0 | } |
1369 | 0 | v.push(b'\t'); |
1370 | | |
1371 | 0 | i += chunk_size; |
1372 | | |
1373 | 0 | for &byte in chunk { |
1374 | 0 | v.push(CHARS[(byte >> 4) as usize]); |
1375 | 0 | v.push(CHARS[(byte & 0xf) as usize]); |
1376 | 0 | v.push(b' '); |
1377 | 0 | } |
1378 | 0 | if chunk_size > chunk.len() { |
1379 | 0 | for j in 0..(chunk_size - chunk.len()) { |
1380 | 0 | v.push(b' '); |
1381 | 0 | v.push(b' '); |
1382 | 0 | v.push(b' '); |
1383 | 0 | } |
1384 | 0 | } |
1385 | 0 | v.push(b'\t'); |
1386 | | |
1387 | 0 | for &byte in chunk { |
1388 | 0 | if (byte >= 32 && byte <= 126) || byte >= 128 { |
1389 | 0 | v.push(byte); |
1390 | 0 | } else { |
1391 | 0 | v.push(b'.'); |
1392 | 0 | } |
1393 | | } |
1394 | 0 | v.push(b'\n'); |
1395 | | } |
1396 | | |
1397 | 0 | String::from_utf8_lossy(&v[..]).into_owned() |
1398 | 0 | } Unexecuted instantiation: <[u8] as nom::traits::HexDisplay>::to_hex_from Unexecuted instantiation: <[u8] as nom::traits::HexDisplay>::to_hex_from |
1399 | | } |
1400 | | |
1401 | | #[cfg(feature = "std")] |
1402 | | impl HexDisplay for str { |
1403 | | #[allow(unused_variables)] |
1404 | 0 | fn to_hex(&self, chunk_size: usize) -> String { |
1405 | 0 | self.to_hex_from(chunk_size, 0) |
1406 | 0 | } Unexecuted instantiation: <str as nom::traits::HexDisplay>::to_hex Unexecuted instantiation: <str as nom::traits::HexDisplay>::to_hex |
1407 | | |
1408 | | #[allow(unused_variables)] |
1409 | 0 | fn to_hex_from(&self, chunk_size: usize, from: usize) -> String { |
1410 | 0 | self.as_bytes().to_hex_from(chunk_size, from) |
1411 | 0 | } Unexecuted instantiation: <str as nom::traits::HexDisplay>::to_hex_from Unexecuted instantiation: <str as nom::traits::HexDisplay>::to_hex_from |
1412 | | } |
1413 | | |
1414 | | #[cfg(test)] |
1415 | | mod tests { |
1416 | | use super::*; |
1417 | | |
1418 | | #[test] |
1419 | | fn test_offset_u8() { |
1420 | | let s = b"abcd123"; |
1421 | | let a = &s[..]; |
1422 | | let b = &a[2..]; |
1423 | | let c = &a[..4]; |
1424 | | let d = &a[3..5]; |
1425 | | assert_eq!(a.offset(b), 2); |
1426 | | assert_eq!(a.offset(c), 0); |
1427 | | assert_eq!(a.offset(d), 3); |
1428 | | } |
1429 | | |
1430 | | #[test] |
1431 | | fn test_offset_str() { |
1432 | | let s = "abcřèÂßÇd123"; |
1433 | | let a = &s[..]; |
1434 | | let b = &a[7..]; |
1435 | | let c = &a[..5]; |
1436 | | let d = &a[5..9]; |
1437 | | assert_eq!(a.offset(b), 7); |
1438 | | assert_eq!(a.offset(c), 0); |
1439 | | assert_eq!(a.offset(d), 5); |
1440 | | } |
1441 | | } |