Coverage Report

Created: 2026-05-16 07:38

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/rust/registry/src/index.crates.io-1949cf8c6b5b557f/nom-8.0.0/src/bytes/complete.rs
Line
Count
Source
1
//! Parsers recognizing bytes streams, complete input version
2
3
use core::marker::PhantomData;
4
5
use crate::error::ParseError;
6
use crate::internal::{IResult, Parser};
7
use crate::traits::{Compare, FindSubstring, FindToken, ToUsize};
8
use crate::Complete;
9
use crate::Emit;
10
use crate::Input;
11
use crate::OutputM;
12
13
/// Recognizes a pattern
14
///
15
/// The input data will be compared to the tag combinator's argument and will return the part of
16
/// the input that matches the argument
17
///
18
/// It will return `Err(Err::Error((_, ErrorKind::Tag)))` if the input doesn't match the pattern
19
/// # Example
20
/// ```rust
21
/// # use nom::{Err, error::{Error, ErrorKind}, Needed, IResult};
22
/// use nom::bytes::complete::tag;
23
///
24
/// fn parser(s: &str) -> IResult<&str, &str> {
25
///   tag("Hello")(s)
26
/// }
27
///
28
/// assert_eq!(parser("Hello, World!"), Ok((", World!", "Hello")));
29
/// assert_eq!(parser("Something"), Err(Err::Error(Error::new("Something", ErrorKind::Tag))));
30
/// assert_eq!(parser(""), Err(Err::Error(Error::new("", ErrorKind::Tag))));
31
/// ```
32
132M
pub fn tag<T, I, Error: ParseError<I>>(tag: T) -> impl Fn(I) -> IResult<I, I, Error>
33
132M
where
34
132M
  I: Input + Compare<T>,
35
132M
  T: Input + Clone,
36
{
37
90.3M
  move |i: I| {
38
90.3M
    let mut parser = super::Tag {
39
90.3M
      tag: tag.clone(),
40
90.3M
      e: PhantomData,
41
90.3M
    };
42
43
90.3M
    parser.process::<OutputM<Emit, Emit, Complete>>(i)
44
90.3M
  }
nom::bytes::complete::tag::<&[u8], &[u8], nom::error::Error<&[u8]>>::{closure#0}
Line
Count
Source
37
79.2k
  move |i: I| {
38
79.2k
    let mut parser = super::Tag {
39
79.2k
      tag: tag.clone(),
40
79.2k
      e: PhantomData,
41
79.2k
    };
42
43
79.2k
    parser.process::<OutputM<Emit, Emit, Complete>>(i)
44
79.2k
  }
nom::bytes::complete::tag::<&str, &[u8], nom::error::Error<&[u8]>>::{closure#0}
Line
Count
Source
37
10.3M
  move |i: I| {
38
10.3M
    let mut parser = super::Tag {
39
10.3M
      tag: tag.clone(),
40
10.3M
      e: PhantomData,
41
10.3M
    };
42
43
10.3M
    parser.process::<OutputM<Emit, Emit, Complete>>(i)
44
10.3M
  }
nom::bytes::complete::tag::<&[u8], &str, nom::error::Error<&str>>::{closure#0}
Line
Count
Source
37
7.15k
  move |i: I| {
38
7.15k
    let mut parser = super::Tag {
39
7.15k
      tag: tag.clone(),
40
7.15k
      e: PhantomData,
41
7.15k
    };
42
43
7.15k
    parser.process::<OutputM<Emit, Emit, Complete>>(i)
44
7.15k
  }
nom::bytes::complete::tag::<&str, &str, nom::error::Error<&str>>::{closure#0}
Line
Count
Source
37
1.72M
  move |i: I| {
38
1.72M
    let mut parser = super::Tag {
39
1.72M
      tag: tag.clone(),
40
1.72M
      e: PhantomData,
41
1.72M
    };
42
43
1.72M
    parser.process::<OutputM<Emit, Emit, Complete>>(i)
44
1.72M
  }
nom::bytes::complete::tag::<&str, &str, suricata::detect::error::RuleParseError<&str>>::{closure#0}
Line
Count
Source
37
321k
  move |i: I| {
38
321k
    let mut parser = super::Tag {
39
321k
      tag: tag.clone(),
40
321k
      e: PhantomData,
41
321k
    };
42
43
321k
    parser.process::<OutputM<Emit, Emit, Complete>>(i)
44
321k
  }
Unexecuted instantiation: nom::bytes::complete::tag::<_, _, _>::{closure#0}
nom::bytes::complete::tag::<&str, &[u8], nom::error::Error<&[u8]>>::{closure#0}
Line
Count
Source
37
77.9M
  move |i: I| {
38
77.9M
    let mut parser = super::Tag {
39
77.9M
      tag: tag.clone(),
40
77.9M
      e: PhantomData,
41
77.9M
    };
42
43
77.9M
    parser.process::<OutputM<Emit, Emit, Complete>>(i)
44
77.9M
  }
45
132M
}
nom::bytes::complete::tag::<&[u8], &[u8], nom::error::Error<&[u8]>>
Line
Count
Source
32
79.2k
pub fn tag<T, I, Error: ParseError<I>>(tag: T) -> impl Fn(I) -> IResult<I, I, Error>
33
79.2k
where
34
79.2k
  I: Input + Compare<T>,
35
79.2k
  T: Input + Clone,
36
{
37
  move |i: I| {
38
    let mut parser = super::Tag {
39
      tag: tag.clone(),
40
      e: PhantomData,
41
    };
42
43
    parser.process::<OutputM<Emit, Emit, Complete>>(i)
44
  }
45
79.2k
}
nom::bytes::complete::tag::<&str, &[u8], nom::error::Error<&[u8]>>
Line
Count
Source
32
9.64M
pub fn tag<T, I, Error: ParseError<I>>(tag: T) -> impl Fn(I) -> IResult<I, I, Error>
33
9.64M
where
34
9.64M
  I: Input + Compare<T>,
35
9.64M
  T: Input + Clone,
36
{
37
  move |i: I| {
38
    let mut parser = super::Tag {
39
      tag: tag.clone(),
40
      e: PhantomData,
41
    };
42
43
    parser.process::<OutputM<Emit, Emit, Complete>>(i)
44
  }
45
9.64M
}
nom::bytes::complete::tag::<&str, &str, nom::error::Error<&str>>
Line
Count
Source
32
1.95M
pub fn tag<T, I, Error: ParseError<I>>(tag: T) -> impl Fn(I) -> IResult<I, I, Error>
33
1.95M
where
34
1.95M
  I: Input + Compare<T>,
35
1.95M
  T: Input + Clone,
36
{
37
  move |i: I| {
38
    let mut parser = super::Tag {
39
      tag: tag.clone(),
40
      e: PhantomData,
41
    };
42
43
    parser.process::<OutputM<Emit, Emit, Complete>>(i)
44
  }
45
1.95M
}
nom::bytes::complete::tag::<&[u8], &str, nom::error::Error<&str>>
Line
Count
Source
32
8.41k
pub fn tag<T, I, Error: ParseError<I>>(tag: T) -> impl Fn(I) -> IResult<I, I, Error>
33
8.41k
where
34
8.41k
  I: Input + Compare<T>,
35
8.41k
  T: Input + Clone,
36
{
37
  move |i: I| {
38
    let mut parser = super::Tag {
39
      tag: tag.clone(),
40
      e: PhantomData,
41
    };
42
43
    parser.process::<OutputM<Emit, Emit, Complete>>(i)
44
  }
45
8.41k
}
nom::bytes::complete::tag::<&str, &str, suricata::detect::error::RuleParseError<&str>>
Line
Count
Source
32
69.2k
pub fn tag<T, I, Error: ParseError<I>>(tag: T) -> impl Fn(I) -> IResult<I, I, Error>
33
69.2k
where
34
69.2k
  I: Input + Compare<T>,
35
69.2k
  T: Input + Clone,
36
{
37
  move |i: I| {
38
    let mut parser = super::Tag {
39
      tag: tag.clone(),
40
      e: PhantomData,
41
    };
42
43
    parser.process::<OutputM<Emit, Emit, Complete>>(i)
44
  }
45
69.2k
}
nom::bytes::complete::tag::<&str, &[u8], nom::error::Error<&[u8]>>
Line
Count
Source
32
120M
pub fn tag<T, I, Error: ParseError<I>>(tag: T) -> impl Fn(I) -> IResult<I, I, Error>
33
120M
where
34
120M
  I: Input + Compare<T>,
35
120M
  T: Input + Clone,
36
{
37
  move |i: I| {
38
    let mut parser = super::Tag {
39
      tag: tag.clone(),
40
      e: PhantomData,
41
    };
42
43
    parser.process::<OutputM<Emit, Emit, Complete>>(i)
44
  }
45
120M
}
Unexecuted instantiation: nom::bytes::complete::tag::<_, _, _>
46
47
/// Recognizes a case insensitive pattern.
48
///
49
/// The input data will be compared to the tag combinator's argument and will return the part of
50
/// the input that matches the argument with no regard to case.
51
///
52
/// It will return `Err(Err::Error((_, ErrorKind::Tag)))` if the input doesn't match the pattern.
53
/// # Example
54
/// ```rust
55
/// # use nom::{Err, error::{Error, ErrorKind}, Needed, IResult};
56
/// use nom::bytes::complete::tag_no_case;
57
///
58
/// fn parser(s: &str) -> IResult<&str, &str> {
59
///   tag_no_case("hello")(s)
60
/// }
61
///
62
/// assert_eq!(parser("Hello, World!"), Ok((", World!", "Hello")));
63
/// assert_eq!(parser("hello, World!"), Ok((", World!", "hello")));
64
/// assert_eq!(parser("HeLlO, World!"), Ok((", World!", "HeLlO")));
65
/// assert_eq!(parser("Something"), Err(Err::Error(Error::new("Something", ErrorKind::Tag))));
66
/// assert_eq!(parser(""), Err(Err::Error(Error::new("", ErrorKind::Tag))));
67
/// ```
68
5.31M
pub fn tag_no_case<T, I, Error: ParseError<I>>(tag: T) -> impl Fn(I) -> IResult<I, I, Error>
69
5.31M
where
70
5.31M
  I: Input + Compare<T>,
71
5.31M
  T: Input + Clone,
72
{
73
5.30M
  move |i: I| {
74
5.30M
    let mut parser = super::TagNoCase {
75
5.30M
      tag: tag.clone(),
76
5.30M
      e: PhantomData,
77
5.30M
    };
78
79
5.30M
    parser.process::<OutputM<Emit, Emit, Complete>>(i)
80
5.30M
  }
nom::bytes::complete::tag_no_case::<&str, &str, nom::error::Error<&str>>::{closure#0}
Line
Count
Source
73
1.28M
  move |i: I| {
74
1.28M
    let mut parser = super::TagNoCase {
75
1.28M
      tag: tag.clone(),
76
1.28M
      e: PhantomData,
77
1.28M
    };
78
79
1.28M
    parser.process::<OutputM<Emit, Emit, Complete>>(i)
80
1.28M
  }
Unexecuted instantiation: nom::bytes::complete::tag_no_case::<_, _, _>::{closure#0}
nom::bytes::complete::tag_no_case::<&str, &[u8], nom::error::Error<&[u8]>>::{closure#0}
Line
Count
Source
73
4.02M
  move |i: I| {
74
4.02M
    let mut parser = super::TagNoCase {
75
4.02M
      tag: tag.clone(),
76
4.02M
      e: PhantomData,
77
4.02M
    };
78
79
4.02M
    parser.process::<OutputM<Emit, Emit, Complete>>(i)
80
4.02M
  }
81
5.31M
}
nom::bytes::complete::tag_no_case::<&str, &str, nom::error::Error<&str>>
Line
Count
Source
68
1.29M
pub fn tag_no_case<T, I, Error: ParseError<I>>(tag: T) -> impl Fn(I) -> IResult<I, I, Error>
69
1.29M
where
70
1.29M
  I: Input + Compare<T>,
71
1.29M
  T: Input + Clone,
72
{
73
  move |i: I| {
74
    let mut parser = super::TagNoCase {
75
      tag: tag.clone(),
76
      e: PhantomData,
77
    };
78
79
    parser.process::<OutputM<Emit, Emit, Complete>>(i)
80
  }
81
1.29M
}
nom::bytes::complete::tag_no_case::<&str, &[u8], nom::error::Error<&[u8]>>
Line
Count
Source
68
4.02M
pub fn tag_no_case<T, I, Error: ParseError<I>>(tag: T) -> impl Fn(I) -> IResult<I, I, Error>
69
4.02M
where
70
4.02M
  I: Input + Compare<T>,
71
4.02M
  T: Input + Clone,
72
{
73
  move |i: I| {
74
    let mut parser = super::TagNoCase {
75
      tag: tag.clone(),
76
      e: PhantomData,
77
    };
78
79
    parser.process::<OutputM<Emit, Emit, Complete>>(i)
80
  }
81
4.02M
}
Unexecuted instantiation: nom::bytes::complete::tag_no_case::<_, _, _>
82
83
/// Parse till certain characters are met.
84
///
85
/// The parser will return the longest slice till one of the characters of the combinator's argument are met.
86
///
87
/// It doesn't consume the matched character.
88
///
89
/// It will return a `Err::Error(("", ErrorKind::IsNot))` if the pattern wasn't met.
90
/// # Example
91
/// ```rust
92
/// # use nom::{Err, error::{Error, ErrorKind}, Needed, IResult};
93
/// use nom::bytes::complete::is_not;
94
///
95
/// fn not_space(s: &str) -> IResult<&str, &str> {
96
///   is_not(" \t\r\n")(s)
97
/// }
98
///
99
/// assert_eq!(not_space("Hello, World!"), Ok((" World!", "Hello,")));
100
/// assert_eq!(not_space("Sometimes\t"), Ok(("\t", "Sometimes")));
101
/// assert_eq!(not_space("Nospace"), Ok(("", "Nospace")));
102
/// assert_eq!(not_space(""), Err(Err::Error(Error::new("", ErrorKind::IsNot))));
103
/// ```
104
1.37M
pub fn is_not<T, I, Error: ParseError<I>>(arr: T) -> impl FnMut(I) -> IResult<I, I, Error>
105
1.37M
where
106
1.37M
  I: Input,
107
1.37M
  T: FindToken<<I as Input>::Item>,
108
{
109
1.37M
  let mut parser = super::is_not(arr);
110
111
1.16M
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
nom::bytes::complete::is_not::<&str, &str, nom::error::Error<&str>>::{closure#0}
Line
Count
Source
111
7.13k
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
nom::bytes::complete::is_not::<&str, &str, suricata::detect::error::RuleParseError<&str>>::{closure#0}
Line
Count
Source
111
497k
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
nom::bytes::complete::is_not::<&str, &[u8], nom::error::Error<&[u8]>>::{closure#0}
Line
Count
Source
111
664k
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
Unexecuted instantiation: nom::bytes::complete::is_not::<_, _, _>::{closure#0}
112
1.37M
}
nom::bytes::complete::is_not::<&str, &str, nom::error::Error<&str>>
Line
Count
Source
104
7.13k
pub fn is_not<T, I, Error: ParseError<I>>(arr: T) -> impl FnMut(I) -> IResult<I, I, Error>
105
7.13k
where
106
7.13k
  I: Input,
107
7.13k
  T: FindToken<<I as Input>::Item>,
108
{
109
7.13k
  let mut parser = super::is_not(arr);
110
111
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
112
7.13k
}
nom::bytes::complete::is_not::<&str, &str, suricata::detect::error::RuleParseError<&str>>
Line
Count
Source
104
243k
pub fn is_not<T, I, Error: ParseError<I>>(arr: T) -> impl FnMut(I) -> IResult<I, I, Error>
105
243k
where
106
243k
  I: Input,
107
243k
  T: FindToken<<I as Input>::Item>,
108
{
109
243k
  let mut parser = super::is_not(arr);
110
111
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
112
243k
}
nom::bytes::complete::is_not::<&str, &[u8], nom::error::Error<&[u8]>>
Line
Count
Source
104
1.12M
pub fn is_not<T, I, Error: ParseError<I>>(arr: T) -> impl FnMut(I) -> IResult<I, I, Error>
105
1.12M
where
106
1.12M
  I: Input,
107
1.12M
  T: FindToken<<I as Input>::Item>,
108
{
109
1.12M
  let mut parser = super::is_not(arr);
110
111
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
112
1.12M
}
Unexecuted instantiation: nom::bytes::complete::is_not::<_, _, _>
113
114
/// Returns the longest slice of the matches the pattern.
115
///
116
/// The parser will return the longest slice consisting of the characters in provided in the
117
/// combinator's argument.
118
///
119
/// It will return a `Err(Err::Error((_, ErrorKind::IsA)))` if the pattern wasn't met.
120
/// # Example
121
/// ```rust
122
/// # use nom::{Err, error::{Error, ErrorKind}, Needed, IResult};
123
/// use nom::bytes::complete::is_a;
124
///
125
/// fn hex(s: &str) -> IResult<&str, &str> {
126
///   is_a("1234567890ABCDEF")(s)
127
/// }
128
///
129
/// assert_eq!(hex("123 and voila"), Ok((" and voila", "123")));
130
/// assert_eq!(hex("DEADBEEF and others"), Ok((" and others", "DEADBEEF")));
131
/// assert_eq!(hex("BADBABEsomething"), Ok(("something", "BADBABE")));
132
/// assert_eq!(hex("D15EA5E"), Ok(("", "D15EA5E")));
133
/// assert_eq!(hex(""), Err(Err::Error(Error::new("", ErrorKind::IsA))));
134
/// ```
135
849k
pub fn is_a<T, I, Error: ParseError<I>>(arr: T) -> impl FnMut(I) -> IResult<I, I, Error>
136
849k
where
137
849k
  I: Input,
138
849k
  T: FindToken<<I as Input>::Item>,
139
{
140
849k
  let mut parser = super::is_a(arr);
141
142
849k
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
nom::bytes::complete::is_a::<&str, &str, nom::error::Error<&str>>::{closure#0}
Line
Count
Source
142
849k
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
Unexecuted instantiation: nom::bytes::complete::is_a::<_, _, _>::{closure#0}
143
849k
}
nom::bytes::complete::is_a::<&str, &str, nom::error::Error<&str>>
Line
Count
Source
135
849k
pub fn is_a<T, I, Error: ParseError<I>>(arr: T) -> impl FnMut(I) -> IResult<I, I, Error>
136
849k
where
137
849k
  I: Input,
138
849k
  T: FindToken<<I as Input>::Item>,
139
{
140
849k
  let mut parser = super::is_a(arr);
141
142
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
143
849k
}
Unexecuted instantiation: nom::bytes::complete::is_a::<_, _, _>
144
145
/// Returns the longest input slice (if any) that matches the predicate.
146
///
147
/// The parser will return the longest slice that matches the given predicate *(a function that
148
/// takes the input and returns a bool)*.
149
/// # Example
150
/// ```rust
151
/// # use nom::{Err, error::ErrorKind, Needed, IResult};
152
/// use nom::bytes::complete::take_while;
153
/// use nom::AsChar;
154
///
155
/// fn alpha(s: &[u8]) -> IResult<&[u8], &[u8]> {
156
///   take_while(AsChar::is_alpha)(s)
157
/// }
158
///
159
/// assert_eq!(alpha(b"latin123"), Ok((&b"123"[..], &b"latin"[..])));
160
/// assert_eq!(alpha(b"12345"), Ok((&b"12345"[..], &b""[..])));
161
/// assert_eq!(alpha(b"latin"), Ok((&b""[..], &b"latin"[..])));
162
/// assert_eq!(alpha(b""), Ok((&b""[..], &b""[..])));
163
/// ```
164
55.3M
pub fn take_while<F, I, Error: ParseError<I>>(cond: F) -> impl FnMut(I) -> IResult<I, I, Error>
165
55.3M
where
166
55.3M
  I: Input,
167
55.3M
  F: Fn(<I as Input>::Item) -> bool,
168
{
169
55.3M
  let mut parser = super::take_while(cond);
170
171
55.5M
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
nom::bytes::complete::take_while::<suricata::detect::uint::parse_flag_list<u8, suricata::mqtt::detect::MqttConnFlag>::{closure#0}, &str, nom::error::Error<&str>>::{closure#0}
Line
Count
Source
171
8.57k
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
nom::bytes::complete::take_while::<suricata::detect::uint::parse_flag_list<u8, suricata::mqtt::detect::MqttFlag>::{closure#0}, &str, nom::error::Error<&str>>::{closure#0}
Line
Count
Source
171
13.9k
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
nom::bytes::complete::take_while::<suricata::detect::uint::parse_flag_list<u8, suricata::websocket::detect::WebSocketFlag>::{closure#0}, &str, nom::error::Error<&str>>::{closure#0}
Line
Count
Source
171
121
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
Unexecuted instantiation: nom::bytes::complete::take_while::<suricata::detect::uint::parse_flag_list<u16, suricata::detect::fragbits::Ipv4FragBits>::{closure#0}, &str, nom::error::Error<&str>>::{closure#0}
nom::bytes::complete::take_while::<suricata::detect::uint::parse_flag_list<u16, suricata::dnp3::detect::Dnp3IndFlag>::{closure#0}, &str, nom::error::Error<&str>>::{closure#0}
Line
Count
Source
171
84
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
nom::bytes::complete::take_while::<suricata::detect::uint::detect_parse_uint<u8>::{closure#0}, &str, nom::error::Error<&str>>::{closure#0}
Line
Count
Source
171
22.1k
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
nom::bytes::complete::take_while::<suricata::detect::uint::detect_parse_uint<u32>::{closure#0}, &str, nom::error::Error<&str>>::{closure#0}
Line
Count
Source
171
33.5k
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
nom::bytes::complete::take_while::<suricata::detect::uint::detect_parse_uint<u16>::{closure#0}, &str, nom::error::Error<&str>>::{closure#0}
Line
Count
Source
171
38.0k
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
nom::bytes::complete::take_while::<suricata::detect::uint::detect_parse_uint<u64>::{closure#0}, &str, nom::error::Error<&str>>::{closure#0}
Line
Count
Source
171
16.2k
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
nom::bytes::complete::take_while::<suricata::detect::uint::detect_parse_unquote_uint<u16>::{closure#0}, &str, nom::error::Error<&str>>::{closure#0}
Line
Count
Source
171
15.2k
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
nom::bytes::complete::take_while::<suricata::detect::uint::detect_parse_uint_bitflags<u8, suricata::mqtt::detect::MqttConnFlag>::{closure#0}, &str, nom::error::Error<&str>>::{closure#0}
Line
Count
Source
171
3.59k
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
nom::bytes::complete::take_while::<suricata::detect::uint::detect_parse_uint_bitflags<u8, suricata::mqtt::detect::MqttFlag>::{closure#0}, &str, nom::error::Error<&str>>::{closure#0}
Line
Count
Source
171
7.00k
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
nom::bytes::complete::take_while::<suricata::detect::uint::detect_parse_uint_bitflags<u8, suricata::websocket::detect::WebSocketFlag>::{closure#0}, &str, nom::error::Error<&str>>::{closure#0}
Line
Count
Source
171
127
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
nom::bytes::complete::take_while::<suricata::detect::uint::detect_parse_uint_bitflags<u16, suricata::detect::fragbits::Ipv4FragBits>::{closure#0}, &str, nom::error::Error<&str>>::{closure#0}
Line
Count
Source
171
543
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
nom::bytes::complete::take_while::<suricata::detect::uint::detect_parse_uint_bitflags<u16, suricata::dnp3::detect::Dnp3IndFlag>::{closure#0}, &str, nom::error::Error<&str>>::{closure#0}
Line
Count
Source
171
90
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
nom::bytes::complete::take_while::<suricata::detect::uint::detect_parse_uint_inclusive<u32>::{closure#0}, &str, nom::error::Error<&str>>::{closure#0}
Line
Count
Source
171
12.6k
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
nom::bytes::complete::take_while::<suricata::detect::float::detect_parse_float<f64>::{closure#0}, &str, nom::error::Error<&str>>::{closure#0}
Line
Count
Source
171
2.28k
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
nom::bytes::complete::take_while::<suricata::ike::detect::ike_detect_chosen_sa_parse_aux::{closure#0}, &str, nom::error::Error<&str>>::{closure#0}
Line
Count
Source
171
1.31k
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
nom::bytes::complete::take_while::<suricata::krb::detect::detect_parse_encryption::{closure#0}, &str, nom::error::Error<&str>>::{closure#0}
Line
Count
Source
171
4.62k
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
nom::bytes::complete::take_while::<suricata::sdp::parser::parse_attributes::{closure#0}, &[u8], nom::error::Error<&[u8]>>::{closure#0}
Line
Count
Source
171
1.43M
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
nom::bytes::complete::take_while::<suricata::sdp::parser::parse_origin_line::{closure#0}, &[u8], nom::error::Error<&[u8]>>::{closure#0}
Line
Count
Source
171
85.4k
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
nom::bytes::complete::take_while::<suricata::sdp::parser::parse_origin_line::{closure#2}, &[u8], nom::error::Error<&[u8]>>::{closure#0}
Line
Count
Source
171
81.1k
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
nom::bytes::complete::take_while::<suricata::sdp::parser::parse_origin_line::{closure#3}, &[u8], nom::error::Error<&[u8]>>::{closure#0}
Line
Count
Source
171
77.5k
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
nom::bytes::complete::take_while::<suricata::sdp::parser::parse_origin_line::{closure#1}, &[u8], nom::error::Error<&[u8]>>::{closure#0}
Line
Count
Source
171
83.1k
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
nom::bytes::complete::take_while::<suricata::sdp::parser::parse_connection_data::{closure#0}, &[u8], nom::error::Error<&[u8]>>::{closure#0}
Line
Count
Source
171
17.3k
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
nom::bytes::complete::take_while::<suricata::sdp::parser::parse_connection_data::{closure#1}, &[u8], nom::error::Error<&[u8]>>::{closure#0}
Line
Count
Source
171
16.5k
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
nom::bytes::complete::take_while::<suricata::detect::stream_size::detect_parse_stream_size::{closure#1}, &str, nom::error::Error<&str>>::{closure#0}
Line
Count
Source
171
2.72k
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
nom::bytes::complete::take_while::<suricata::detect::uri::detect_parse_urilen::{closure#0}, &str, nom::error::Error<&str>>::{closure#0}
Line
Count
Source
171
1.86k
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
nom::bytes::complete::take_while::<suricata::detect::requires::parse_key_value::{closure#0}, &str, nom::error::Error<&str>>::{closure#0}
Line
Count
Source
171
30.8k
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
nom::bytes::complete::take_while::<suricata::sdp::parser::is_time_char, &[u8], nom::error::Error<&[u8]>>::{closure#0}
Line
Count
Source
171
207k
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
nom::bytes::complete::take_while::<suricata::sdp::parser::is_token_char, &[u8], nom::error::Error<&[u8]>>::{closure#0}
Line
Count
Source
171
87.0k
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
nom::bytes::complete::take_while::<suricata::sdp::parser::is_ipaddr_char, &[u8], nom::error::Error<&[u8]>>::{closure#0}
Line
Count
Source
171
16.0k
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
nom::bytes::complete::take_while::<suricata::sdp::parser::is_request_uri_char, &[u8], nom::error::Error<&[u8]>>::{closure#0}
Line
Count
Source
171
9.93k
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
nom::bytes::complete::take_while::<suricata::sdp::parser::is_session_name_char, &[u8], nom::error::Error<&[u8]>>::{closure#0}
Line
Count
Source
171
75.3k
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
nom::bytes::complete::take_while::<suricata::mime::mime::is_mime_space, &[u8], nom::error::Error<&[u8]>>::{closure#0}
Line
Count
Source
171
34.0M
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
nom::bytes::complete::take_while::<suricata::pop3::pop3::is_base64_char, &[u8], nom::error::Error<&[u8]>>::{closure#0}
Line
Count
Source
171
6.40k
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
Unexecuted instantiation: nom::bytes::complete::take_while::<_, _, _>::{closure#0}
nom::bytes::complete::take_while::<suricata_htp::util::hex_digits::{closure#0}::{closure#0}, &[u8], nom::error::Error<&[u8]>>::{closure#0}
Line
Count
Source
171
60.4k
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
nom::bytes::complete::take_while::<suricata_htp::util::take_ascii_whitespace::{closure#0}::{closure#0}, &[u8], nom::error::Error<&[u8]>>::{closure#0}
Line
Count
Source
171
989k
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
Unexecuted instantiation: nom::bytes::complete::take_while::<suricata_htp::util::take_until_null::{closure#0}, &[u8], nom::error::Error<&[u8]>>::{closure#0}
nom::bytes::complete::take_while::<suricata_htp::util::nom_take_is_space::{closure#0}, &[u8], nom::error::Error<&[u8]>>::{closure#0}
Line
Count
Source
171
743k
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
nom::bytes::complete::take_while::<suricata_htp::util::take_not_is_space::{closure#0}, &[u8], nom::error::Error<&[u8]>>::{closure#0}
Line
Count
Source
171
6.37M
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
nom::bytes::complete::take_while::<suricata_htp::util::take_is_space_or_null::{closure#0}, &[u8], nom::error::Error<&[u8]>>::{closure#0}
Line
Count
Source
171
3.30M
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
nom::bytes::complete::take_while::<suricata_htp::parsers::protocol_version::{closure#0}, &[u8], nom::error::Error<&[u8]>>::{closure#0}
Line
Count
Source
171
118k
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
nom::bytes::complete::take_while::<suricata_htp::util::is_chunked_ctl_char, &[u8], nom::error::Error<&[u8]>>::{closure#0}
Line
Count
Source
171
66.1k
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
nom::bytes::complete::take_while::<suricata_htp::util::is_space, &[u8], nom::error::Error<&[u8]>>::{closure#0}
Line
Count
Source
171
7.47M
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
172
55.3M
}
nom::bytes::complete::take_while::<suricata::ike::detect::ike_detect_chosen_sa_parse_aux::{closure#0}, &str, nom::error::Error<&str>>
Line
Count
Source
164
1.31k
pub fn take_while<F, I, Error: ParseError<I>>(cond: F) -> impl FnMut(I) -> IResult<I, I, Error>
165
1.31k
where
166
1.31k
  I: Input,
167
1.31k
  F: Fn(<I as Input>::Item) -> bool,
168
{
169
1.31k
  let mut parser = super::take_while(cond);
170
171
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
172
1.31k
}
nom::bytes::complete::take_while::<suricata::sdp::parser::parse_attributes::{closure#0}, &[u8], nom::error::Error<&[u8]>>
Line
Count
Source
164
324k
pub fn take_while<F, I, Error: ParseError<I>>(cond: F) -> impl FnMut(I) -> IResult<I, I, Error>
165
324k
where
166
324k
  I: Input,
167
324k
  F: Fn(<I as Input>::Item) -> bool,
168
{
169
324k
  let mut parser = super::take_while(cond);
170
171
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
172
324k
}
nom::bytes::complete::take_while::<suricata::sdp::parser::parse_origin_line::{closure#0}, &[u8], nom::error::Error<&[u8]>>
Line
Count
Source
164
85.4k
pub fn take_while<F, I, Error: ParseError<I>>(cond: F) -> impl FnMut(I) -> IResult<I, I, Error>
165
85.4k
where
166
85.4k
  I: Input,
167
85.4k
  F: Fn(<I as Input>::Item) -> bool,
168
{
169
85.4k
  let mut parser = super::take_while(cond);
170
171
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
172
85.4k
}
nom::bytes::complete::take_while::<suricata::sdp::parser::parse_origin_line::{closure#2}, &[u8], nom::error::Error<&[u8]>>
Line
Count
Source
164
81.1k
pub fn take_while<F, I, Error: ParseError<I>>(cond: F) -> impl FnMut(I) -> IResult<I, I, Error>
165
81.1k
where
166
81.1k
  I: Input,
167
81.1k
  F: Fn(<I as Input>::Item) -> bool,
168
{
169
81.1k
  let mut parser = super::take_while(cond);
170
171
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
172
81.1k
}
nom::bytes::complete::take_while::<suricata::sdp::parser::parse_origin_line::{closure#3}, &[u8], nom::error::Error<&[u8]>>
Line
Count
Source
164
77.5k
pub fn take_while<F, I, Error: ParseError<I>>(cond: F) -> impl FnMut(I) -> IResult<I, I, Error>
165
77.5k
where
166
77.5k
  I: Input,
167
77.5k
  F: Fn(<I as Input>::Item) -> bool,
168
{
169
77.5k
  let mut parser = super::take_while(cond);
170
171
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
172
77.5k
}
nom::bytes::complete::take_while::<suricata::sdp::parser::parse_origin_line::{closure#1}, &[u8], nom::error::Error<&[u8]>>
Line
Count
Source
164
83.1k
pub fn take_while<F, I, Error: ParseError<I>>(cond: F) -> impl FnMut(I) -> IResult<I, I, Error>
165
83.1k
where
166
83.1k
  I: Input,
167
83.1k
  F: Fn(<I as Input>::Item) -> bool,
168
{
169
83.1k
  let mut parser = super::take_while(cond);
170
171
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
172
83.1k
}
nom::bytes::complete::take_while::<suricata::sdp::parser::parse_connection_data::{closure#0}, &[u8], nom::error::Error<&[u8]>>
Line
Count
Source
164
17.3k
pub fn take_while<F, I, Error: ParseError<I>>(cond: F) -> impl FnMut(I) -> IResult<I, I, Error>
165
17.3k
where
166
17.3k
  I: Input,
167
17.3k
  F: Fn(<I as Input>::Item) -> bool,
168
{
169
17.3k
  let mut parser = super::take_while(cond);
170
171
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
172
17.3k
}
nom::bytes::complete::take_while::<suricata::sdp::parser::parse_connection_data::{closure#1}, &[u8], nom::error::Error<&[u8]>>
Line
Count
Source
164
16.5k
pub fn take_while<F, I, Error: ParseError<I>>(cond: F) -> impl FnMut(I) -> IResult<I, I, Error>
165
16.5k
where
166
16.5k
  I: Input,
167
16.5k
  F: Fn(<I as Input>::Item) -> bool,
168
{
169
16.5k
  let mut parser = super::take_while(cond);
170
171
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
172
16.5k
}
nom::bytes::complete::take_while::<suricata::detect::uri::detect_parse_urilen::{closure#0}, &str, nom::error::Error<&str>>
Line
Count
Source
164
1.86k
pub fn take_while<F, I, Error: ParseError<I>>(cond: F) -> impl FnMut(I) -> IResult<I, I, Error>
165
1.86k
where
166
1.86k
  I: Input,
167
1.86k
  F: Fn(<I as Input>::Item) -> bool,
168
{
169
1.86k
  let mut parser = super::take_while(cond);
170
171
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
172
1.86k
}
nom::bytes::complete::take_while::<suricata::sdp::parser::is_time_char, &[u8], nom::error::Error<&[u8]>>
Line
Count
Source
164
815k
pub fn take_while<F, I, Error: ParseError<I>>(cond: F) -> impl FnMut(I) -> IResult<I, I, Error>
165
815k
where
166
815k
  I: Input,
167
815k
  F: Fn(<I as Input>::Item) -> bool,
168
{
169
815k
  let mut parser = super::take_while(cond);
170
171
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
172
815k
}
nom::bytes::complete::take_while::<suricata::sdp::parser::is_token_char, &[u8], nom::error::Error<&[u8]>>
Line
Count
Source
164
87.0k
pub fn take_while<F, I, Error: ParseError<I>>(cond: F) -> impl FnMut(I) -> IResult<I, I, Error>
165
87.0k
where
166
87.0k
  I: Input,
167
87.0k
  F: Fn(<I as Input>::Item) -> bool,
168
{
169
87.0k
  let mut parser = super::take_while(cond);
170
171
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
172
87.0k
}
nom::bytes::complete::take_while::<suricata::sdp::parser::is_ipaddr_char, &[u8], nom::error::Error<&[u8]>>
Line
Count
Source
164
16.0k
pub fn take_while<F, I, Error: ParseError<I>>(cond: F) -> impl FnMut(I) -> IResult<I, I, Error>
165
16.0k
where
166
16.0k
  I: Input,
167
16.0k
  F: Fn(<I as Input>::Item) -> bool,
168
{
169
16.0k
  let mut parser = super::take_while(cond);
170
171
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
172
16.0k
}
nom::bytes::complete::take_while::<suricata::sdp::parser::is_request_uri_char, &[u8], nom::error::Error<&[u8]>>
Line
Count
Source
164
9.93k
pub fn take_while<F, I, Error: ParseError<I>>(cond: F) -> impl FnMut(I) -> IResult<I, I, Error>
165
9.93k
where
166
9.93k
  I: Input,
167
9.93k
  F: Fn(<I as Input>::Item) -> bool,
168
{
169
9.93k
  let mut parser = super::take_while(cond);
170
171
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
172
9.93k
}
nom::bytes::complete::take_while::<suricata::sdp::parser::is_session_name_char, &[u8], nom::error::Error<&[u8]>>
Line
Count
Source
164
75.3k
pub fn take_while<F, I, Error: ParseError<I>>(cond: F) -> impl FnMut(I) -> IResult<I, I, Error>
165
75.3k
where
166
75.3k
  I: Input,
167
75.3k
  F: Fn(<I as Input>::Item) -> bool,
168
{
169
75.3k
  let mut parser = super::take_while(cond);
170
171
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
172
75.3k
}
nom::bytes::complete::take_while::<suricata::mime::mime::is_mime_space, &[u8], nom::error::Error<&[u8]>>
Line
Count
Source
164
34.0M
pub fn take_while<F, I, Error: ParseError<I>>(cond: F) -> impl FnMut(I) -> IResult<I, I, Error>
165
34.0M
where
166
34.0M
  I: Input,
167
34.0M
  F: Fn(<I as Input>::Item) -> bool,
168
{
169
34.0M
  let mut parser = super::take_while(cond);
170
171
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
172
34.0M
}
nom::bytes::complete::take_while::<suricata::detect::uint::parse_flag_list<u8, suricata::mqtt::detect::MqttConnFlag>::{closure#0}, &str, nom::error::Error<&str>>
Line
Count
Source
164
8.57k
pub fn take_while<F, I, Error: ParseError<I>>(cond: F) -> impl FnMut(I) -> IResult<I, I, Error>
165
8.57k
where
166
8.57k
  I: Input,
167
8.57k
  F: Fn(<I as Input>::Item) -> bool,
168
{
169
8.57k
  let mut parser = super::take_while(cond);
170
171
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
172
8.57k
}
nom::bytes::complete::take_while::<suricata::detect::uint::parse_flag_list<u8, suricata::mqtt::detect::MqttFlag>::{closure#0}, &str, nom::error::Error<&str>>
Line
Count
Source
164
13.9k
pub fn take_while<F, I, Error: ParseError<I>>(cond: F) -> impl FnMut(I) -> IResult<I, I, Error>
165
13.9k
where
166
13.9k
  I: Input,
167
13.9k
  F: Fn(<I as Input>::Item) -> bool,
168
{
169
13.9k
  let mut parser = super::take_while(cond);
170
171
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
172
13.9k
}
nom::bytes::complete::take_while::<suricata::detect::uint::parse_flag_list<u8, suricata::websocket::detect::WebSocketFlag>::{closure#0}, &str, nom::error::Error<&str>>
Line
Count
Source
164
121
pub fn take_while<F, I, Error: ParseError<I>>(cond: F) -> impl FnMut(I) -> IResult<I, I, Error>
165
121
where
166
121
  I: Input,
167
121
  F: Fn(<I as Input>::Item) -> bool,
168
{
169
121
  let mut parser = super::take_while(cond);
170
171
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
172
121
}
Unexecuted instantiation: nom::bytes::complete::take_while::<suricata::detect::uint::parse_flag_list<u16, suricata::detect::fragbits::Ipv4FragBits>::{closure#0}, &str, nom::error::Error<&str>>
nom::bytes::complete::take_while::<suricata::detect::uint::parse_flag_list<u16, suricata::dnp3::detect::Dnp3IndFlag>::{closure#0}, &str, nom::error::Error<&str>>
Line
Count
Source
164
84
pub fn take_while<F, I, Error: ParseError<I>>(cond: F) -> impl FnMut(I) -> IResult<I, I, Error>
165
84
where
166
84
  I: Input,
167
84
  F: Fn(<I as Input>::Item) -> bool,
168
{
169
84
  let mut parser = super::take_while(cond);
170
171
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
172
84
}
nom::bytes::complete::take_while::<suricata::detect::uint::detect_parse_uint<u8>::{closure#0}, &str, nom::error::Error<&str>>
Line
Count
Source
164
22.1k
pub fn take_while<F, I, Error: ParseError<I>>(cond: F) -> impl FnMut(I) -> IResult<I, I, Error>
165
22.1k
where
166
22.1k
  I: Input,
167
22.1k
  F: Fn(<I as Input>::Item) -> bool,
168
{
169
22.1k
  let mut parser = super::take_while(cond);
170
171
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
172
22.1k
}
nom::bytes::complete::take_while::<suricata::detect::uint::detect_parse_uint<u32>::{closure#0}, &str, nom::error::Error<&str>>
Line
Count
Source
164
33.5k
pub fn take_while<F, I, Error: ParseError<I>>(cond: F) -> impl FnMut(I) -> IResult<I, I, Error>
165
33.5k
where
166
33.5k
  I: Input,
167
33.5k
  F: Fn(<I as Input>::Item) -> bool,
168
{
169
33.5k
  let mut parser = super::take_while(cond);
170
171
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
172
33.5k
}
nom::bytes::complete::take_while::<suricata::detect::uint::detect_parse_uint<u16>::{closure#0}, &str, nom::error::Error<&str>>
Line
Count
Source
164
38.0k
pub fn take_while<F, I, Error: ParseError<I>>(cond: F) -> impl FnMut(I) -> IResult<I, I, Error>
165
38.0k
where
166
38.0k
  I: Input,
167
38.0k
  F: Fn(<I as Input>::Item) -> bool,
168
{
169
38.0k
  let mut parser = super::take_while(cond);
170
171
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
172
38.0k
}
nom::bytes::complete::take_while::<suricata::detect::uint::detect_parse_uint<u64>::{closure#0}, &str, nom::error::Error<&str>>
Line
Count
Source
164
16.2k
pub fn take_while<F, I, Error: ParseError<I>>(cond: F) -> impl FnMut(I) -> IResult<I, I, Error>
165
16.2k
where
166
16.2k
  I: Input,
167
16.2k
  F: Fn(<I as Input>::Item) -> bool,
168
{
169
16.2k
  let mut parser = super::take_while(cond);
170
171
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
172
16.2k
}
nom::bytes::complete::take_while::<suricata::detect::uint::detect_parse_unquote_uint<u16>::{closure#0}, &str, nom::error::Error<&str>>
Line
Count
Source
164
15.2k
pub fn take_while<F, I, Error: ParseError<I>>(cond: F) -> impl FnMut(I) -> IResult<I, I, Error>
165
15.2k
where
166
15.2k
  I: Input,
167
15.2k
  F: Fn(<I as Input>::Item) -> bool,
168
{
169
15.2k
  let mut parser = super::take_while(cond);
170
171
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
172
15.2k
}
nom::bytes::complete::take_while::<suricata::detect::uint::detect_parse_uint_bitflags<u8, suricata::mqtt::detect::MqttConnFlag>::{closure#0}, &str, nom::error::Error<&str>>
Line
Count
Source
164
3.59k
pub fn take_while<F, I, Error: ParseError<I>>(cond: F) -> impl FnMut(I) -> IResult<I, I, Error>
165
3.59k
where
166
3.59k
  I: Input,
167
3.59k
  F: Fn(<I as Input>::Item) -> bool,
168
{
169
3.59k
  let mut parser = super::take_while(cond);
170
171
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
172
3.59k
}
nom::bytes::complete::take_while::<suricata::detect::uint::detect_parse_uint_bitflags<u8, suricata::mqtt::detect::MqttFlag>::{closure#0}, &str, nom::error::Error<&str>>
Line
Count
Source
164
7.00k
pub fn take_while<F, I, Error: ParseError<I>>(cond: F) -> impl FnMut(I) -> IResult<I, I, Error>
165
7.00k
where
166
7.00k
  I: Input,
167
7.00k
  F: Fn(<I as Input>::Item) -> bool,
168
{
169
7.00k
  let mut parser = super::take_while(cond);
170
171
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
172
7.00k
}
nom::bytes::complete::take_while::<suricata::detect::uint::detect_parse_uint_bitflags<u8, suricata::websocket::detect::WebSocketFlag>::{closure#0}, &str, nom::error::Error<&str>>
Line
Count
Source
164
127
pub fn take_while<F, I, Error: ParseError<I>>(cond: F) -> impl FnMut(I) -> IResult<I, I, Error>
165
127
where
166
127
  I: Input,
167
127
  F: Fn(<I as Input>::Item) -> bool,
168
{
169
127
  let mut parser = super::take_while(cond);
170
171
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
172
127
}
nom::bytes::complete::take_while::<suricata::detect::uint::detect_parse_uint_bitflags<u16, suricata::detect::fragbits::Ipv4FragBits>::{closure#0}, &str, nom::error::Error<&str>>
Line
Count
Source
164
543
pub fn take_while<F, I, Error: ParseError<I>>(cond: F) -> impl FnMut(I) -> IResult<I, I, Error>
165
543
where
166
543
  I: Input,
167
543
  F: Fn(<I as Input>::Item) -> bool,
168
{
169
543
  let mut parser = super::take_while(cond);
170
171
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
172
543
}
nom::bytes::complete::take_while::<suricata::detect::uint::detect_parse_uint_bitflags<u16, suricata::dnp3::detect::Dnp3IndFlag>::{closure#0}, &str, nom::error::Error<&str>>
Line
Count
Source
164
90
pub fn take_while<F, I, Error: ParseError<I>>(cond: F) -> impl FnMut(I) -> IResult<I, I, Error>
165
90
where
166
90
  I: Input,
167
90
  F: Fn(<I as Input>::Item) -> bool,
168
{
169
90
  let mut parser = super::take_while(cond);
170
171
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
172
90
}
nom::bytes::complete::take_while::<suricata::detect::uint::detect_parse_uint_inclusive<u32>::{closure#0}, &str, nom::error::Error<&str>>
Line
Count
Source
164
12.6k
pub fn take_while<F, I, Error: ParseError<I>>(cond: F) -> impl FnMut(I) -> IResult<I, I, Error>
165
12.6k
where
166
12.6k
  I: Input,
167
12.6k
  F: Fn(<I as Input>::Item) -> bool,
168
{
169
12.6k
  let mut parser = super::take_while(cond);
170
171
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
172
12.6k
}
nom::bytes::complete::take_while::<suricata::detect::float::detect_parse_float<f64>::{closure#0}, &str, nom::error::Error<&str>>
Line
Count
Source
164
2.28k
pub fn take_while<F, I, Error: ParseError<I>>(cond: F) -> impl FnMut(I) -> IResult<I, I, Error>
165
2.28k
where
166
2.28k
  I: Input,
167
2.28k
  F: Fn(<I as Input>::Item) -> bool,
168
{
169
2.28k
  let mut parser = super::take_while(cond);
170
171
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
172
2.28k
}
nom::bytes::complete::take_while::<suricata::pop3::pop3::is_base64_char, &[u8], nom::error::Error<&[u8]>>
Line
Count
Source
164
6.40k
pub fn take_while<F, I, Error: ParseError<I>>(cond: F) -> impl FnMut(I) -> IResult<I, I, Error>
165
6.40k
where
166
6.40k
  I: Input,
167
6.40k
  F: Fn(<I as Input>::Item) -> bool,
168
{
169
6.40k
  let mut parser = super::take_while(cond);
170
171
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
172
6.40k
}
nom::bytes::complete::take_while::<suricata::detect::stream_size::detect_parse_stream_size::{closure#1}, &str, nom::error::Error<&str>>
Line
Count
Source
164
2.72k
pub fn take_while<F, I, Error: ParseError<I>>(cond: F) -> impl FnMut(I) -> IResult<I, I, Error>
165
2.72k
where
166
2.72k
  I: Input,
167
2.72k
  F: Fn(<I as Input>::Item) -> bool,
168
{
169
2.72k
  let mut parser = super::take_while(cond);
170
171
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
172
2.72k
}
nom::bytes::complete::take_while::<suricata::detect::requires::parse_key_value::{closure#0}, &str, nom::error::Error<&str>>
Line
Count
Source
164
30.8k
pub fn take_while<F, I, Error: ParseError<I>>(cond: F) -> impl FnMut(I) -> IResult<I, I, Error>
165
30.8k
where
166
30.8k
  I: Input,
167
30.8k
  F: Fn(<I as Input>::Item) -> bool,
168
{
169
30.8k
  let mut parser = super::take_while(cond);
170
171
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
172
30.8k
}
nom::bytes::complete::take_while::<suricata::krb::detect::detect_parse_encryption::{closure#0}, &str, nom::error::Error<&str>>
Line
Count
Source
164
4.62k
pub fn take_while<F, I, Error: ParseError<I>>(cond: F) -> impl FnMut(I) -> IResult<I, I, Error>
165
4.62k
where
166
4.62k
  I: Input,
167
4.62k
  F: Fn(<I as Input>::Item) -> bool,
168
{
169
4.62k
  let mut parser = super::take_while(cond);
170
171
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
172
4.62k
}
nom::bytes::complete::take_while::<suricata_htp::util::hex_digits::{closure#0}::{closure#0}, &[u8], nom::error::Error<&[u8]>>
Line
Count
Source
164
60.4k
pub fn take_while<F, I, Error: ParseError<I>>(cond: F) -> impl FnMut(I) -> IResult<I, I, Error>
165
60.4k
where
166
60.4k
  I: Input,
167
60.4k
  F: Fn(<I as Input>::Item) -> bool,
168
{
169
60.4k
  let mut parser = super::take_while(cond);
170
171
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
172
60.4k
}
nom::bytes::complete::take_while::<suricata_htp::util::take_ascii_whitespace::{closure#0}::{closure#0}, &[u8], nom::error::Error<&[u8]>>
Line
Count
Source
164
989k
pub fn take_while<F, I, Error: ParseError<I>>(cond: F) -> impl FnMut(I) -> IResult<I, I, Error>
165
989k
where
166
989k
  I: Input,
167
989k
  F: Fn(<I as Input>::Item) -> bool,
168
{
169
989k
  let mut parser = super::take_while(cond);
170
171
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
172
989k
}
Unexecuted instantiation: nom::bytes::complete::take_while::<suricata_htp::util::take_until_null::{closure#0}, &[u8], nom::error::Error<&[u8]>>
nom::bytes::complete::take_while::<suricata_htp::util::nom_take_is_space::{closure#0}, &[u8], nom::error::Error<&[u8]>>
Line
Count
Source
164
743k
pub fn take_while<F, I, Error: ParseError<I>>(cond: F) -> impl FnMut(I) -> IResult<I, I, Error>
165
743k
where
166
743k
  I: Input,
167
743k
  F: Fn(<I as Input>::Item) -> bool,
168
{
169
743k
  let mut parser = super::take_while(cond);
170
171
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
172
743k
}
nom::bytes::complete::take_while::<suricata_htp::util::take_not_is_space::{closure#0}, &[u8], nom::error::Error<&[u8]>>
Line
Count
Source
164
6.37M
pub fn take_while<F, I, Error: ParseError<I>>(cond: F) -> impl FnMut(I) -> IResult<I, I, Error>
165
6.37M
where
166
6.37M
  I: Input,
167
6.37M
  F: Fn(<I as Input>::Item) -> bool,
168
{
169
6.37M
  let mut parser = super::take_while(cond);
170
171
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
172
6.37M
}
nom::bytes::complete::take_while::<suricata_htp::util::take_is_space_or_null::{closure#0}, &[u8], nom::error::Error<&[u8]>>
Line
Count
Source
164
3.30M
pub fn take_while<F, I, Error: ParseError<I>>(cond: F) -> impl FnMut(I) -> IResult<I, I, Error>
165
3.30M
where
166
3.30M
  I: Input,
167
3.30M
  F: Fn(<I as Input>::Item) -> bool,
168
{
169
3.30M
  let mut parser = super::take_while(cond);
170
171
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
172
3.30M
}
nom::bytes::complete::take_while::<suricata_htp::util::is_chunked_ctl_char, &[u8], nom::error::Error<&[u8]>>
Line
Count
Source
164
66.1k
pub fn take_while<F, I, Error: ParseError<I>>(cond: F) -> impl FnMut(I) -> IResult<I, I, Error>
165
66.1k
where
166
66.1k
  I: Input,
167
66.1k
  F: Fn(<I as Input>::Item) -> bool,
168
{
169
66.1k
  let mut parser = super::take_while(cond);
170
171
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
172
66.1k
}
nom::bytes::complete::take_while::<suricata_htp::util::is_space, &[u8], nom::error::Error<&[u8]>>
Line
Count
Source
164
7.47M
pub fn take_while<F, I, Error: ParseError<I>>(cond: F) -> impl FnMut(I) -> IResult<I, I, Error>
165
7.47M
where
166
7.47M
  I: Input,
167
7.47M
  F: Fn(<I as Input>::Item) -> bool,
168
{
169
7.47M
  let mut parser = super::take_while(cond);
170
171
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
172
7.47M
}
nom::bytes::complete::take_while::<suricata_htp::parsers::protocol_version::{closure#0}, &[u8], nom::error::Error<&[u8]>>
Line
Count
Source
164
387k
pub fn take_while<F, I, Error: ParseError<I>>(cond: F) -> impl FnMut(I) -> IResult<I, I, Error>
165
387k
where
166
387k
  I: Input,
167
387k
  F: Fn(<I as Input>::Item) -> bool,
168
{
169
387k
  let mut parser = super::take_while(cond);
170
171
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
172
387k
}
Unexecuted instantiation: nom::bytes::complete::take_while::<_, _, _>
173
174
/// Returns the longest (at least 1) input slice that matches the predicate.
175
///
176
/// The parser will return the longest slice that matches the given predicate *(a function that
177
/// takes the input and returns a bool)*.
178
///
179
/// It will return an `Err(Err::Error((_, ErrorKind::TakeWhile1)))` if the pattern wasn't met.
180
/// # Example
181
/// ```rust
182
/// # use nom::{Err, error::{Error, ErrorKind}, Needed, IResult};
183
/// use nom::bytes::complete::take_while1;
184
/// use nom::AsChar;
185
///
186
/// fn alpha(s: &[u8]) -> IResult<&[u8], &[u8]> {
187
///   take_while1(AsChar::is_alpha)(s)
188
/// }
189
///
190
/// assert_eq!(alpha(b"latin123"), Ok((&b"123"[..], &b"latin"[..])));
191
/// assert_eq!(alpha(b"latin"), Ok((&b""[..], &b"latin"[..])));
192
/// assert_eq!(alpha(b"12345"), Err(Err::Error(Error::new(&b"12345"[..], ErrorKind::TakeWhile1))));
193
/// ```
194
158k
pub fn take_while1<F, I, Error: ParseError<I>>(cond: F) -> impl FnMut(I) -> IResult<I, I, Error>
195
158k
where
196
158k
  I: Input,
197
158k
  F: Fn(<I as Input>::Item) -> bool,
198
{
199
158k
  let mut parser = super::take_while1(cond);
200
201
158k
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
nom::bytes::complete::take_while1::<suricata::applayertemplate::template::probe::{closure#0}, &[u8], nom::error::Error<&[u8]>>::{closure#0}
Line
Count
Source
201
7.44k
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
nom::bytes::complete::take_while1::<suricata::util::is_alphanumeric_or_hyphen, &[u8], nom::error::Error<&[u8]>>::{closure#0}
Line
Count
Source
201
105k
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
nom::bytes::complete::take_while1::<suricata::krb::detect::is_alphanumeric_or_dash, &str, nom::error::Error<&str>>::{closure#0}
Line
Count
Source
201
40.4k
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
Unexecuted instantiation: nom::bytes::complete::take_while1::<_, _, _>::{closure#0}
nom::bytes::complete::take_while1::<suricata_htp::util::is_valid_chunked_length_data::{closure#0}, &[u8], nom::error::Error<&[u8]>>::{closure#0}
Line
Count
Source
201
5.67k
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
202
158k
}
nom::bytes::complete::take_while1::<suricata::util::is_alphanumeric_or_hyphen, &[u8], nom::error::Error<&[u8]>>
Line
Count
Source
194
105k
pub fn take_while1<F, I, Error: ParseError<I>>(cond: F) -> impl FnMut(I) -> IResult<I, I, Error>
195
105k
where
196
105k
  I: Input,
197
105k
  F: Fn(<I as Input>::Item) -> bool,
198
{
199
105k
  let mut parser = super::take_while1(cond);
200
201
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
202
105k
}
nom::bytes::complete::take_while1::<suricata::applayertemplate::template::probe::{closure#0}, &[u8], nom::error::Error<&[u8]>>
Line
Count
Source
194
7.44k
pub fn take_while1<F, I, Error: ParseError<I>>(cond: F) -> impl FnMut(I) -> IResult<I, I, Error>
195
7.44k
where
196
7.44k
  I: Input,
197
7.44k
  F: Fn(<I as Input>::Item) -> bool,
198
{
199
7.44k
  let mut parser = super::take_while1(cond);
200
201
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
202
7.44k
}
nom::bytes::complete::take_while1::<suricata::krb::detect::is_alphanumeric_or_dash, &str, nom::error::Error<&str>>
Line
Count
Source
194
40.4k
pub fn take_while1<F, I, Error: ParseError<I>>(cond: F) -> impl FnMut(I) -> IResult<I, I, Error>
195
40.4k
where
196
40.4k
  I: Input,
197
40.4k
  F: Fn(<I as Input>::Item) -> bool,
198
{
199
40.4k
  let mut parser = super::take_while1(cond);
200
201
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
202
40.4k
}
nom::bytes::complete::take_while1::<suricata_htp::util::is_valid_chunked_length_data::{closure#0}, &[u8], nom::error::Error<&[u8]>>
Line
Count
Source
194
5.67k
pub fn take_while1<F, I, Error: ParseError<I>>(cond: F) -> impl FnMut(I) -> IResult<I, I, Error>
195
5.67k
where
196
5.67k
  I: Input,
197
5.67k
  F: Fn(<I as Input>::Item) -> bool,
198
{
199
5.67k
  let mut parser = super::take_while1(cond);
200
201
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
202
5.67k
}
Unexecuted instantiation: nom::bytes::complete::take_while1::<_, _, _>
203
204
/// Returns the longest (m <= len <= n) input slice that matches the predicate.
205
///
206
/// The parser will return the longest slice that matches the given predicate *(a function that
207
/// takes the input and returns a bool)*.
208
///
209
/// It will return an `Err::Error((_, ErrorKind::TakeWhileMN))` if the pattern wasn't met or is out
210
/// of range (m <= len <= n).
211
/// # Example
212
/// ```rust
213
/// # use nom::{Err, error::{Error, ErrorKind}, Needed, IResult};
214
/// use nom::bytes::complete::take_while_m_n;
215
/// use nom::AsChar;
216
///
217
/// fn short_alpha(s: &[u8]) -> IResult<&[u8], &[u8]> {
218
///   take_while_m_n(3, 6, AsChar::is_alpha)(s)
219
/// }
220
///
221
/// assert_eq!(short_alpha(b"latin123"), Ok((&b"123"[..], &b"latin"[..])));
222
/// assert_eq!(short_alpha(b"lengthy"), Ok((&b"y"[..], &b"length"[..])));
223
/// assert_eq!(short_alpha(b"latin"), Ok((&b""[..], &b"latin"[..])));
224
/// assert_eq!(short_alpha(b"ed"), Err(Err::Error(Error::new(&b"ed"[..], ErrorKind::TakeWhileMN))));
225
/// assert_eq!(short_alpha(b"12345"), Err(Err::Error(Error::new(&b"12345"[..], ErrorKind::TakeWhileMN))));
226
/// ```
227
1.31M
pub fn take_while_m_n<F, I, Error: ParseError<I>>(
228
1.31M
  m: usize,
229
1.31M
  n: usize,
230
1.31M
  cond: F,
231
1.31M
) -> impl FnMut(I) -> IResult<I, I, Error>
232
1.31M
where
233
1.31M
  I: Input,
234
1.31M
  F: Fn(<I as Input>::Item) -> bool,
235
{
236
1.31M
  let mut parser = super::take_while_m_n(m, n, cond);
237
238
4.15M
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
nom::bytes::complete::take_while_m_n::<suricata::sdp::parser::parse_media_description::{closure#2}, &[u8], nom::error::Error<&[u8]>>::{closure#0}
Line
Count
Source
238
9.68k
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
nom::bytes::complete::take_while_m_n::<suricata::sdp::parser::parse_media_description::{closure#4}, &[u8], nom::error::Error<&[u8]>>::{closure#0}
Line
Count
Source
238
3.41M
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
nom::bytes::complete::take_while_m_n::<suricata::sdp::parser::parse_media_description::{closure#1}, &[u8], nom::error::Error<&[u8]>>::{closure#0}
Line
Count
Source
238
297k
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
nom::bytes::complete::take_while_m_n::<suricata::pop3::pop3::parse_response_header_with_octets::{closure#0}, &[u8], nom::error::Error<&[u8]>>::{closure#0}
Line
Count
Source
238
13.6k
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
nom::bytes::complete::take_while_m_n::<suricata_htp::util::validate_hostname::{closure#1}, &[u8], nom::error::Error<&[u8]>>::{closure#0}
Line
Count
Source
238
236k
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
Unexecuted instantiation: nom::bytes::complete::take_while_m_n::<_, _, _>::{closure#0}
nom::bytes::complete::take_while_m_n::<suricata_htp::urlencoded::decode_valid_hex::{closure#0}::{closure#0}, &[u8], nom::error::Error<&[u8]>>::{closure#0}
Line
Count
Source
238
60.3k
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
nom::bytes::complete::take_while_m_n::<suricata_htp::urlencoded::path_decode_valid_hex::{closure#0}::{closure#0}, &[u8], nom::error::Error<&[u8]>>::{closure#0}
Line
Count
Source
238
121k
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
Unexecuted instantiation: nom::bytes::complete::take_while_m_n::<suricata_htp::urlencoded::decode_valid_u_encoding::{closure#0}::{closure#0}, &[u8], nom::error::Error<&[u8]>>::{closure#0}
Unexecuted instantiation: nom::bytes::complete::take_while_m_n::<suricata_htp::urlencoded::path_decode_valid_u_encoding::{closure#0}::{closure#0}, &[u8], nom::error::Error<&[u8]>>::{closure#0}
239
1.31M
}
nom::bytes::complete::take_while_m_n::<suricata::sdp::parser::parse_media_description::{closure#2}, &[u8], nom::error::Error<&[u8]>>
Line
Count
Source
227
296k
pub fn take_while_m_n<F, I, Error: ParseError<I>>(
228
296k
  m: usize,
229
296k
  n: usize,
230
296k
  cond: F,
231
296k
) -> impl FnMut(I) -> IResult<I, I, Error>
232
296k
where
233
296k
  I: Input,
234
296k
  F: Fn(<I as Input>::Item) -> bool,
235
{
236
296k
  let mut parser = super::take_while_m_n(m, n, cond);
237
238
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
239
296k
}
nom::bytes::complete::take_while_m_n::<suricata::sdp::parser::parse_media_description::{closure#4}, &[u8], nom::error::Error<&[u8]>>
Line
Count
Source
227
293k
pub fn take_while_m_n<F, I, Error: ParseError<I>>(
228
293k
  m: usize,
229
293k
  n: usize,
230
293k
  cond: F,
231
293k
) -> impl FnMut(I) -> IResult<I, I, Error>
232
293k
where
233
293k
  I: Input,
234
293k
  F: Fn(<I as Input>::Item) -> bool,
235
{
236
293k
  let mut parser = super::take_while_m_n(m, n, cond);
237
238
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
239
293k
}
nom::bytes::complete::take_while_m_n::<suricata::sdp::parser::parse_media_description::{closure#1}, &[u8], nom::error::Error<&[u8]>>
Line
Count
Source
227
297k
pub fn take_while_m_n<F, I, Error: ParseError<I>>(
228
297k
  m: usize,
229
297k
  n: usize,
230
297k
  cond: F,
231
297k
) -> impl FnMut(I) -> IResult<I, I, Error>
232
297k
where
233
297k
  I: Input,
234
297k
  F: Fn(<I as Input>::Item) -> bool,
235
{
236
297k
  let mut parser = super::take_while_m_n(m, n, cond);
237
238
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
239
297k
}
nom::bytes::complete::take_while_m_n::<suricata::pop3::pop3::parse_response_header_with_octets::{closure#0}, &[u8], nom::error::Error<&[u8]>>
Line
Count
Source
227
13.6k
pub fn take_while_m_n<F, I, Error: ParseError<I>>(
228
13.6k
  m: usize,
229
13.6k
  n: usize,
230
13.6k
  cond: F,
231
13.6k
) -> impl FnMut(I) -> IResult<I, I, Error>
232
13.6k
where
233
13.6k
  I: Input,
234
13.6k
  F: Fn(<I as Input>::Item) -> bool,
235
{
236
13.6k
  let mut parser = super::take_while_m_n(m, n, cond);
237
238
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
239
13.6k
}
nom::bytes::complete::take_while_m_n::<suricata_htp::urlencoded::decode_valid_hex::{closure#0}::{closure#0}, &[u8], nom::error::Error<&[u8]>>
Line
Count
Source
227
60.3k
pub fn take_while_m_n<F, I, Error: ParseError<I>>(
228
60.3k
  m: usize,
229
60.3k
  n: usize,
230
60.3k
  cond: F,
231
60.3k
) -> impl FnMut(I) -> IResult<I, I, Error>
232
60.3k
where
233
60.3k
  I: Input,
234
60.3k
  F: Fn(<I as Input>::Item) -> bool,
235
{
236
60.3k
  let mut parser = super::take_while_m_n(m, n, cond);
237
238
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
239
60.3k
}
nom::bytes::complete::take_while_m_n::<suricata_htp::urlencoded::path_decode_valid_hex::{closure#0}::{closure#0}, &[u8], nom::error::Error<&[u8]>>
Line
Count
Source
227
121k
pub fn take_while_m_n<F, I, Error: ParseError<I>>(
228
121k
  m: usize,
229
121k
  n: usize,
230
121k
  cond: F,
231
121k
) -> impl FnMut(I) -> IResult<I, I, Error>
232
121k
where
233
121k
  I: Input,
234
121k
  F: Fn(<I as Input>::Item) -> bool,
235
{
236
121k
  let mut parser = super::take_while_m_n(m, n, cond);
237
238
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
239
121k
}
Unexecuted instantiation: nom::bytes::complete::take_while_m_n::<suricata_htp::urlencoded::decode_valid_u_encoding::{closure#0}::{closure#0}, &[u8], nom::error::Error<&[u8]>>
Unexecuted instantiation: nom::bytes::complete::take_while_m_n::<suricata_htp::urlencoded::path_decode_valid_u_encoding::{closure#0}::{closure#0}, &[u8], nom::error::Error<&[u8]>>
nom::bytes::complete::take_while_m_n::<suricata_htp::util::validate_hostname::{closure#1}, &[u8], nom::error::Error<&[u8]>>
Line
Count
Source
227
236k
pub fn take_while_m_n<F, I, Error: ParseError<I>>(
228
236k
  m: usize,
229
236k
  n: usize,
230
236k
  cond: F,
231
236k
) -> impl FnMut(I) -> IResult<I, I, Error>
232
236k
where
233
236k
  I: Input,
234
236k
  F: Fn(<I as Input>::Item) -> bool,
235
{
236
236k
  let mut parser = super::take_while_m_n(m, n, cond);
237
238
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
239
236k
}
Unexecuted instantiation: nom::bytes::complete::take_while_m_n::<_, _, _>
240
241
/// Returns the longest input slice (if any) till a predicate is met.
242
///
243
/// The parser will return the longest slice till the given predicate *(a function that
244
/// takes the input and returns a bool)*.
245
/// # Example
246
/// ```rust
247
/// # use nom::{Err, error::ErrorKind, Needed, IResult};
248
/// use nom::bytes::complete::take_till;
249
///
250
/// fn till_colon(s: &str) -> IResult<&str, &str> {
251
///   take_till(|c| c == ':')(s)
252
/// }
253
///
254
/// assert_eq!(till_colon("latin:123"), Ok((":123", "latin")));
255
/// assert_eq!(till_colon(":empty matched"), Ok((":empty matched", ""))); //allowed
256
/// assert_eq!(till_colon("12345"), Ok(("", "12345")));
257
/// assert_eq!(till_colon(""), Ok(("", "")));
258
/// ```
259
#[allow(clippy::redundant_closure)]
260
23.6M
pub fn take_till<F, I, Error: ParseError<I>>(cond: F) -> impl FnMut(I) -> IResult<I, I, Error>
261
23.6M
where
262
23.6M
  I: Input,
263
23.6M
  F: Fn(<I as Input>::Item) -> bool,
264
{
265
23.6M
  let mut parser = super::take_till(cond);
266
267
22.7M
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
nom::bytes::complete::take_till::<suricata::mime::mime::mime_parse_skip_line::{closure#0}, &[u8], nom::error::Error<&[u8]>>::{closure#0}
Line
Count
Source
267
57.9k
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
nom::bytes::complete::take_till::<suricata::mime::mime::mime_parse_boundary_regular::{closure#0}, &[u8], nom::error::Error<&[u8]>>::{closure#0}
Line
Count
Source
267
22.0k
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
Unexecuted instantiation: nom::bytes::complete::take_till::<suricata::detect::uint::detect_parse_unquote_uint<u16>::{closure#1}, &str, nom::error::Error<&str>>::{closure#0}
nom::bytes::complete::take_till::<suricata::mime::mime::mime_parse_header_line::{closure#0}, &[u8], nom::error::Error<&[u8]>>::{closure#0}
Line
Count
Source
267
9.55M
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
nom::bytes::complete::take_till::<suricata::mime::mime::mime_parse_value_until_semicolon::{closure#0}, &[u8], nom::error::Error<&[u8]>>::{closure#0}
Line
Count
Source
267
12.3M
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
nom::bytes::complete::take_till::<suricata::detect::requires::parse_key_value::{closure#1}, &str, nom::error::Error<&str>>::{closure#0}
Line
Count
Source
267
30.8k
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
nom::bytes::complete::take_till::<suricata::detect::requires::parse_next_version_part::{closure#0}, &str, nom::error::Error<&str>>::{closure#0}
Line
Count
Source
267
86.8k
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
nom::bytes::complete::take_till::<suricata::sdp::parser::is_line_ending, &[u8], nom::error::Error<&[u8]>>::{closure#0}
Line
Count
Source
267
292k
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
Unexecuted instantiation: nom::bytes::complete::take_till::<_, _, _>::{closure#0}
nom::bytes::complete::take_till::<suricata_htp::parsers::content_type::{closure#0}::{closure#0}, &[u8], nom::error::Error<&[u8]>>::{closure#0}
Line
Count
Source
267
43.2k
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
nom::bytes::complete::take_till::<suricata_htp::parsers::query::{closure#0}::{closure#0}, &[u8], nom::error::Error<&[u8]>>::{closure#0}
Line
Count
Source
267
24.6k
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
nom::bytes::complete::take_till::<suricata_htp::util::ascii_digits::{closure#0}, &[u8], nom::error::Error<&[u8]>>::{closure#0}
Line
Count
Source
267
317k
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
268
23.6M
}
nom::bytes::complete::take_till::<suricata::mime::mime::mime_parse_skip_line::{closure#0}, &[u8], nom::error::Error<&[u8]>>
Line
Count
Source
260
57.9k
pub fn take_till<F, I, Error: ParseError<I>>(cond: F) -> impl FnMut(I) -> IResult<I, I, Error>
261
57.9k
where
262
57.9k
  I: Input,
263
57.9k
  F: Fn(<I as Input>::Item) -> bool,
264
{
265
57.9k
  let mut parser = super::take_till(cond);
266
267
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
268
57.9k
}
nom::bytes::complete::take_till::<suricata::mime::mime::mime_parse_header_line::{closure#0}, &[u8], nom::error::Error<&[u8]>>
Line
Count
Source
260
9.55M
pub fn take_till<F, I, Error: ParseError<I>>(cond: F) -> impl FnMut(I) -> IResult<I, I, Error>
261
9.55M
where
262
9.55M
  I: Input,
263
9.55M
  F: Fn(<I as Input>::Item) -> bool,
264
{
265
9.55M
  let mut parser = super::take_till(cond);
266
267
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
268
9.55M
}
nom::bytes::complete::take_till::<suricata::mime::mime::mime_parse_boundary_regular::{closure#0}, &[u8], nom::error::Error<&[u8]>>
Line
Count
Source
260
22.0k
pub fn take_till<F, I, Error: ParseError<I>>(cond: F) -> impl FnMut(I) -> IResult<I, I, Error>
261
22.0k
where
262
22.0k
  I: Input,
263
22.0k
  F: Fn(<I as Input>::Item) -> bool,
264
{
265
22.0k
  let mut parser = super::take_till(cond);
266
267
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
268
22.0k
}
nom::bytes::complete::take_till::<suricata::mime::mime::mime_parse_value_until_semicolon::{closure#0}, &[u8], nom::error::Error<&[u8]>>
Line
Count
Source
260
12.3M
pub fn take_till<F, I, Error: ParseError<I>>(cond: F) -> impl FnMut(I) -> IResult<I, I, Error>
261
12.3M
where
262
12.3M
  I: Input,
263
12.3M
  F: Fn(<I as Input>::Item) -> bool,
264
{
265
12.3M
  let mut parser = super::take_till(cond);
266
267
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
268
12.3M
}
nom::bytes::complete::take_till::<suricata::sdp::parser::is_line_ending, &[u8], nom::error::Error<&[u8]>>
Line
Count
Source
260
863k
pub fn take_till<F, I, Error: ParseError<I>>(cond: F) -> impl FnMut(I) -> IResult<I, I, Error>
261
863k
where
262
863k
  I: Input,
263
863k
  F: Fn(<I as Input>::Item) -> bool,
264
{
265
863k
  let mut parser = super::take_till(cond);
266
267
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
268
863k
}
Unexecuted instantiation: nom::bytes::complete::take_till::<suricata::detect::uint::detect_parse_unquote_uint<u16>::{closure#1}, &str, nom::error::Error<&str>>
nom::bytes::complete::take_till::<suricata::detect::requires::parse_key_value::{closure#1}, &str, nom::error::Error<&str>>
Line
Count
Source
260
30.8k
pub fn take_till<F, I, Error: ParseError<I>>(cond: F) -> impl FnMut(I) -> IResult<I, I, Error>
261
30.8k
where
262
30.8k
  I: Input,
263
30.8k
  F: Fn(<I as Input>::Item) -> bool,
264
{
265
30.8k
  let mut parser = super::take_till(cond);
266
267
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
268
30.8k
}
nom::bytes::complete::take_till::<suricata::detect::requires::parse_next_version_part::{closure#0}, &str, nom::error::Error<&str>>
Line
Count
Source
260
86.8k
pub fn take_till<F, I, Error: ParseError<I>>(cond: F) -> impl FnMut(I) -> IResult<I, I, Error>
261
86.8k
where
262
86.8k
  I: Input,
263
86.8k
  F: Fn(<I as Input>::Item) -> bool,
264
{
265
86.8k
  let mut parser = super::take_till(cond);
266
267
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
268
86.8k
}
nom::bytes::complete::take_till::<suricata_htp::util::ascii_digits::{closure#0}, &[u8], nom::error::Error<&[u8]>>
Line
Count
Source
260
317k
pub fn take_till<F, I, Error: ParseError<I>>(cond: F) -> impl FnMut(I) -> IResult<I, I, Error>
261
317k
where
262
317k
  I: Input,
263
317k
  F: Fn(<I as Input>::Item) -> bool,
264
{
265
317k
  let mut parser = super::take_till(cond);
266
267
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
268
317k
}
nom::bytes::complete::take_till::<suricata_htp::parsers::content_type::{closure#0}::{closure#0}, &[u8], nom::error::Error<&[u8]>>
Line
Count
Source
260
43.2k
pub fn take_till<F, I, Error: ParseError<I>>(cond: F) -> impl FnMut(I) -> IResult<I, I, Error>
261
43.2k
where
262
43.2k
  I: Input,
263
43.2k
  F: Fn(<I as Input>::Item) -> bool,
264
{
265
43.2k
  let mut parser = super::take_till(cond);
266
267
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
268
43.2k
}
nom::bytes::complete::take_till::<suricata_htp::parsers::query::{closure#0}::{closure#0}, &[u8], nom::error::Error<&[u8]>>
Line
Count
Source
260
349k
pub fn take_till<F, I, Error: ParseError<I>>(cond: F) -> impl FnMut(I) -> IResult<I, I, Error>
261
349k
where
262
349k
  I: Input,
263
349k
  F: Fn(<I as Input>::Item) -> bool,
264
{
265
349k
  let mut parser = super::take_till(cond);
266
267
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
268
349k
}
Unexecuted instantiation: nom::bytes::complete::take_till::<_, _, _>
269
270
/// Returns the longest (at least 1) input slice till a predicate is met.
271
///
272
/// The parser will return the longest slice till the given predicate *(a function that
273
/// takes the input and returns a bool)*.
274
///
275
/// It will return `Err(Err::Error((_, ErrorKind::TakeTill1)))` if the input is empty or the
276
/// predicate matches the first input.
277
/// # Example
278
/// ```rust
279
/// # use nom::{Err, error::{Error, ErrorKind}, Needed, IResult};
280
/// use nom::bytes::complete::take_till1;
281
///
282
/// fn till_colon(s: &str) -> IResult<&str, &str> {
283
///   take_till1(|c| c == ':')(s)
284
/// }
285
///
286
/// assert_eq!(till_colon("latin:123"), Ok((":123", "latin")));
287
/// assert_eq!(till_colon(":empty matched"), Err(Err::Error(Error::new(":empty matched", ErrorKind::TakeTill1))));
288
/// assert_eq!(till_colon("12345"), Ok(("", "12345")));
289
/// assert_eq!(till_colon(""), Err(Err::Error(Error::new("", ErrorKind::TakeTill1))));
290
/// ```
291
#[allow(clippy::redundant_closure)]
292
0
pub fn take_till1<F, I, Error: ParseError<I>>(cond: F) -> impl FnMut(I) -> IResult<I, I, Error>
293
0
where
294
0
  I: Input,
295
0
  F: Fn(<I as Input>::Item) -> bool,
296
{
297
0
  let mut parser = super::take_till1(cond);
298
299
0
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
300
0
}
301
302
/// Returns an input slice containing the first N input elements (Input[..N]).
303
///
304
/// It will return `Err(Err::Error((_, ErrorKind::Eof)))` if the input is shorter than the argument.
305
/// # Example
306
/// ```rust
307
/// # use nom::{Err, error::{Error, ErrorKind}, Needed, IResult};
308
/// use nom::bytes::complete::take;
309
///
310
/// fn take6(s: &str) -> IResult<&str, &str> {
311
///   take(6usize)(s)
312
/// }
313
///
314
/// assert_eq!(take6("1234567"), Ok(("7", "123456")));
315
/// assert_eq!(take6("things"), Ok(("", "things")));
316
/// assert_eq!(take6("short"), Err(Err::Error(Error::new("short", ErrorKind::Eof))));
317
/// assert_eq!(take6(""), Err(Err::Error(Error::new("", ErrorKind::Eof))));
318
/// ```
319
///
320
/// The units that are taken will depend on the input type. For example, for a
321
/// `&str` it will take a number of `char`'s, whereas for a `&[u8]` it will
322
/// take that many `u8`'s:
323
///
324
/// ```rust
325
/// use nom::error::Error;
326
/// use nom::bytes::complete::take;
327
///
328
/// assert_eq!(take::<_, _, Error<_>>(1usize)("💙"), Ok(("", "💙")));
329
/// assert_eq!(take::<_, _, Error<_>>(1usize)("💙".as_bytes()), Ok((b"\x9F\x92\x99".as_ref(), b"\xF0".as_ref())));
330
/// ```
331
8.30M
pub fn take<C, I, Error: ParseError<I>>(count: C) -> impl FnMut(I) -> IResult<I, I, Error>
332
8.30M
where
333
8.30M
  I: Input,
334
8.30M
  C: ToUsize,
335
{
336
8.30M
  let mut parser = super::take(count);
337
338
8.30M
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
nom::bytes::complete::take::<usize, &[u8], nom::error::Error<&[u8]>>::{closure#0}
Line
Count
Source
338
2.69M
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
nom::bytes::complete::take::<u8, &[u8], suricata::quic::error::QuicError>::{closure#0}
Line
Count
Source
338
127k
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
nom::bytes::complete::take::<usize, &[u8], suricata::quic::error::QuicError>::{closure#0}
Line
Count
Source
338
5.26M
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
nom::bytes::complete::take::<u32, &[u8], suricata::quic::error::QuicError>::{closure#0}
Line
Count
Source
338
128k
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
nom::bytes::complete::take::<usize, &str, nom::error::Error<&str>>::{closure#0}
Line
Count
Source
338
54.3k
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
Unexecuted instantiation: nom::bytes::complete::take::<_, _, _>::{closure#0}
nom::bytes::complete::take::<usize, &[u8], nom::error::Error<&[u8]>>::{closure#0}
Line
Count
Source
338
38.9k
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
339
8.30M
}
nom::bytes::complete::take::<usize, &[u8], nom::error::Error<&[u8]>>
Line
Count
Source
331
2.69M
pub fn take<C, I, Error: ParseError<I>>(count: C) -> impl FnMut(I) -> IResult<I, I, Error>
332
2.69M
where
333
2.69M
  I: Input,
334
2.69M
  C: ToUsize,
335
{
336
2.69M
  let mut parser = super::take(count);
337
338
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
339
2.69M
}
nom::bytes::complete::take::<u8, &[u8], suricata::quic::error::QuicError>
Line
Count
Source
331
127k
pub fn take<C, I, Error: ParseError<I>>(count: C) -> impl FnMut(I) -> IResult<I, I, Error>
332
127k
where
333
127k
  I: Input,
334
127k
  C: ToUsize,
335
{
336
127k
  let mut parser = super::take(count);
337
338
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
339
127k
}
nom::bytes::complete::take::<usize, &[u8], suricata::quic::error::QuicError>
Line
Count
Source
331
5.26M
pub fn take<C, I, Error: ParseError<I>>(count: C) -> impl FnMut(I) -> IResult<I, I, Error>
332
5.26M
where
333
5.26M
  I: Input,
334
5.26M
  C: ToUsize,
335
{
336
5.26M
  let mut parser = super::take(count);
337
338
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
339
5.26M
}
nom::bytes::complete::take::<u32, &[u8], suricata::quic::error::QuicError>
Line
Count
Source
331
128k
pub fn take<C, I, Error: ParseError<I>>(count: C) -> impl FnMut(I) -> IResult<I, I, Error>
332
128k
where
333
128k
  I: Input,
334
128k
  C: ToUsize,
335
{
336
128k
  let mut parser = super::take(count);
337
338
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
339
128k
}
nom::bytes::complete::take::<usize, &str, nom::error::Error<&str>>
Line
Count
Source
331
54.3k
pub fn take<C, I, Error: ParseError<I>>(count: C) -> impl FnMut(I) -> IResult<I, I, Error>
332
54.3k
where
333
54.3k
  I: Input,
334
54.3k
  C: ToUsize,
335
{
336
54.3k
  let mut parser = super::take(count);
337
338
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
339
54.3k
}
nom::bytes::complete::take::<usize, &[u8], nom::error::Error<&[u8]>>
Line
Count
Source
331
38.9k
pub fn take<C, I, Error: ParseError<I>>(count: C) -> impl FnMut(I) -> IResult<I, I, Error>
332
38.9k
where
333
38.9k
  I: Input,
334
38.9k
  C: ToUsize,
335
{
336
38.9k
  let mut parser = super::take(count);
337
338
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
339
38.9k
}
Unexecuted instantiation: nom::bytes::complete::take::<_, _, _>
340
341
/// Returns the input slice up to the first occurrence of the pattern.
342
///
343
/// It doesn't consume the pattern. It will return `Err(Err::Error((_, ErrorKind::TakeUntil)))`
344
/// if the pattern wasn't met.
345
/// # Example
346
/// ```rust
347
/// # use nom::{Err, error::{Error, ErrorKind}, Needed, IResult};
348
/// use nom::bytes::complete::take_until;
349
///
350
/// fn until_eof(s: &str) -> IResult<&str, &str> {
351
///   take_until("eof")(s)
352
/// }
353
///
354
/// assert_eq!(until_eof("hello, worldeof"), Ok(("eof", "hello, world")));
355
/// assert_eq!(until_eof("hello, world"), Err(Err::Error(Error::new("hello, world", ErrorKind::TakeUntil))));
356
/// assert_eq!(until_eof(""), Err(Err::Error(Error::new("", ErrorKind::TakeUntil))));
357
/// assert_eq!(until_eof("1eof2eof"), Ok(("eof2eof", "1")));
358
/// ```
359
13.6M
pub fn take_until<T, I, Error: ParseError<I>>(tag: T) -> impl FnMut(I) -> IResult<I, I, Error>
360
13.6M
where
361
13.6M
  I: Input + FindSubstring<T>,
362
13.6M
  T: Input + Clone,
363
{
364
13.6M
  let mut parser = super::take_until(tag);
365
366
13.4M
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
nom::bytes::complete::take_until::<&str, &[u8], nom::error::Error<&[u8]>>::{closure#0}
Line
Count
Source
366
12.9M
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
Unexecuted instantiation: nom::bytes::complete::take_until::<_, _, _>::{closure#0}
nom::bytes::complete::take_until::<&str, &[u8], nom::error::Error<&[u8]>>::{closure#0}
Line
Count
Source
366
545k
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
367
13.6M
}
nom::bytes::complete::take_until::<&str, &[u8], nom::error::Error<&[u8]>>
Line
Count
Source
359
12.9M
pub fn take_until<T, I, Error: ParseError<I>>(tag: T) -> impl FnMut(I) -> IResult<I, I, Error>
360
12.9M
where
361
12.9M
  I: Input + FindSubstring<T>,
362
12.9M
  T: Input + Clone,
363
{
364
12.9M
  let mut parser = super::take_until(tag);
365
366
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
367
12.9M
}
nom::bytes::complete::take_until::<&str, &[u8], nom::error::Error<&[u8]>>
Line
Count
Source
359
652k
pub fn take_until<T, I, Error: ParseError<I>>(tag: T) -> impl FnMut(I) -> IResult<I, I, Error>
360
652k
where
361
652k
  I: Input + FindSubstring<T>,
362
652k
  T: Input + Clone,
363
{
364
652k
  let mut parser = super::take_until(tag);
365
366
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
367
652k
}
Unexecuted instantiation: nom::bytes::complete::take_until::<_, _, _>
368
369
/// Returns the non empty input slice up to the first occurrence of the pattern.
370
///
371
/// It doesn't consume the pattern. It will return `Err(Err::Error((_, ErrorKind::TakeUntil)))`
372
/// if the pattern wasn't met.
373
/// # Example
374
/// ```rust
375
/// # use nom::{Err, error::{Error, ErrorKind}, Needed, IResult};
376
/// use nom::bytes::complete::take_until1;
377
///
378
/// fn until_eof(s: &str) -> IResult<&str, &str> {
379
///   take_until1("eof")(s)
380
/// }
381
///
382
/// assert_eq!(until_eof("hello, worldeof"), Ok(("eof", "hello, world")));
383
/// assert_eq!(until_eof("hello, world"), Err(Err::Error(Error::new("hello, world", ErrorKind::TakeUntil))));
384
/// assert_eq!(until_eof(""), Err(Err::Error(Error::new("", ErrorKind::TakeUntil))));
385
/// assert_eq!(until_eof("1eof2eof"), Ok(("eof2eof", "1")));
386
/// assert_eq!(until_eof("eof"), Err(Err::Error(Error::new("eof", ErrorKind::TakeUntil))));
387
/// ```
388
0
pub fn take_until1<T, I, Error: ParseError<I>>(tag: T) -> impl FnMut(I) -> IResult<I, I, Error>
389
0
where
390
0
  I: Input + FindSubstring<T>,
391
0
  T: Input + Clone,
392
{
393
0
  let mut parser = super::take_until1(tag);
394
395
0
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
396
0
}
397
398
/// Matches a byte string with escaped characters.
399
///
400
/// * The first argument matches the normal characters (it must not accept the control character)
401
/// * The second argument is the control character (like `\` in most languages)
402
/// * The third argument matches the escaped characters
403
/// # Example
404
/// ```
405
/// # use nom::{Err, error::ErrorKind, Needed, IResult};
406
/// # use nom::character::complete::digit1;
407
/// use nom::bytes::complete::escaped;
408
/// use nom::character::complete::one_of;
409
///
410
/// fn esc(s: &str) -> IResult<&str, &str> {
411
///   escaped(digit1, '\\', one_of(r#""n\"#))(s)
412
/// }
413
///
414
/// assert_eq!(esc("123;"), Ok((";", "123")));
415
/// assert_eq!(esc(r#"12\"34;"#), Ok((";", r#"12\"34"#)));
416
/// ```
417
///
418
0
pub fn escaped<'a, I, Error, F, G>(
419
0
  normal: F,
420
0
  control_char: char,
421
0
  escapable: G,
422
0
) -> impl FnMut(I) -> IResult<I, I, Error>
423
0
where
424
0
  I: Clone + crate::traits::Offset + Input + 'a,
425
0
  <I as Input>::Item: crate::traits::AsChar,
426
0
  F: Parser<I, Error = Error>,
427
0
  G: Parser<I, Error = Error>,
428
0
  Error: ParseError<I>,
429
{
430
0
  let mut parser = super::escaped(normal, control_char, escapable);
431
432
0
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
433
0
}
434
435
/// Matches a byte string with escaped characters.
436
///
437
/// * The first argument matches the normal characters (it must not match the control character)
438
/// * The second argument is the control character (like `\` in most languages)
439
/// * The third argument matches the escaped characters and transforms them
440
///
441
/// As an example, the chain `abc\tdef` could be `abc    def` (it also consumes the control character)
442
///
443
/// ```
444
/// # use nom::{Err, error::ErrorKind, Needed, IResult};
445
/// # use std::str::from_utf8;
446
/// use nom::bytes::complete::{escaped_transform, tag};
447
/// use nom::character::complete::alpha1;
448
/// use nom::branch::alt;
449
/// use nom::combinator::value;
450
///
451
/// fn parser(input: &str) -> IResult<&str, String> {
452
///   escaped_transform(
453
///     alpha1,
454
///     '\\',
455
///     alt((
456
///       value("\\", tag("\\")),
457
///       value("\"", tag("\"")),
458
///       value("\n", tag("n")),
459
///     ))
460
///   )(input)
461
/// }
462
///
463
/// assert_eq!(parser("ab\\\"cd"), Ok(("", String::from("ab\"cd"))));
464
/// assert_eq!(parser("ab\\ncd"), Ok(("", String::from("ab\ncd"))));
465
/// ```
466
#[cfg(feature = "alloc")]
467
#[cfg_attr(feature = "docsrs", doc(cfg(feature = "alloc")))]
468
0
pub fn escaped_transform<I, Error, F, G, O1, O2, ExtendItem, Output>(
469
0
  normal: F,
470
0
  control_char: char,
471
0
  transform: G,
472
0
) -> impl FnMut(I) -> IResult<I, Output, Error>
473
0
where
474
0
  I: Clone + crate::traits::Offset + Input,
475
0
  I: crate::traits::ExtendInto<Item = ExtendItem, Extender = Output>,
476
0
  O1: crate::traits::ExtendInto<Item = ExtendItem, Extender = Output>,
477
0
  O2: crate::traits::ExtendInto<Item = ExtendItem, Extender = Output>,
478
0
  <I as Input>::Item: crate::traits::AsChar,
479
0
  F: Parser<I, Output = O1, Error = Error>,
480
0
  G: Parser<I, Output = O2, Error = Error>,
481
0
  Error: ParseError<I>,
482
{
483
0
  let mut parser = super::escaped_transform(normal, control_char, transform);
484
485
0
  move |i: I| parser.process::<OutputM<Emit, Emit, Complete>>(i)
486
0
}
487
488
#[cfg(test)]
489
mod tests {
490
  use super::*;
491
  use crate::error::ErrorKind;
492
  use crate::AsChar;
493
  use crate::Err;
494
495
  #[test]
496
  fn complete_take_while_m_n_utf8_all_matching() {
497
    let result: IResult<&str, &str> =
498
      super::take_while_m_n(1, 4, |c: char| c.is_alphabetic())("øn");
499
    assert_eq!(result, Ok(("", "øn")));
500
  }
501
502
  #[test]
503
  fn complete_take_while_m_n_utf8_all_matching_substring() {
504
    let result: IResult<&str, &str> =
505
      super::take_while_m_n(1, 1, |c: char| c.is_alphabetic())("øn");
506
    assert_eq!(result, Ok(("n", "ø")));
507
  }
508
509
  // issue #1336 "escaped hangs if normal parser accepts empty"
510
  fn escaped_string(input: &str) -> IResult<&str, &str> {
511
    use crate::character::complete::{alpha0, one_of};
512
    escaped(alpha0, '\\', one_of("n"))(input)
513
  }
514
515
  // issue #1336 "escaped hangs if normal parser accepts empty"
516
  #[test]
517
  fn escaped_hang() {
518
    escaped_string("7").unwrap();
519
    escaped_string("a7").unwrap();
520
  }
521
522
  // issue ##1118 escaped does not work with empty string
523
  fn unquote(input: &str) -> IResult<&str, &str> {
524
    use crate::bytes::complete::*;
525
    use crate::character::complete::*;
526
    use crate::combinator::opt;
527
    use crate::sequence::delimited;
528
529
    delimited(
530
      char('"'),
531
      escaped(opt(none_of(r#"\""#)), '\\', one_of(r#"\"rnt"#)),
532
      char('"'),
533
    )
534
    .parse(input)
535
  }
536
537
  #[test]
538
  fn escaped_hang_1118() {
539
    assert_eq!(unquote(r#""""#), Ok(("", "")));
540
  }
541
542
  // issue #1630 take_while_m_n is invalid for multi-byte UTF-8 characters
543
  #[test]
544
  fn complete_take_while_m_n_multibyte() {
545
    use crate::error::Error;
546
547
    fn multi_byte_chars(s: &str, m: usize, n: usize) -> IResult<&str, &str> {
548
      take_while_m_n(m, n, |c: char| c.len() > 1)(s)
549
    }
550
551
    assert_eq!(multi_byte_chars("€ latin", 0, 64), Ok((" latin", "€")));
552
    assert_eq!(multi_byte_chars("𝄠 latin", 0, 1), Ok((" latin", "𝄠")));
553
    assert_eq!(multi_byte_chars("باب latin", 0, 64), Ok((" latin", "باب")));
554
    assert_eq!(
555
      multi_byte_chars("💣💢ᾠ latin", 3, 3),
556
      Ok((" latin", "💣💢ᾠ"))
557
    );
558
    assert_eq!(multi_byte_chars("latin", 0, 64), Ok(("latin", "")));
559
    assert_eq!(multi_byte_chars("باب", 1, 3), Ok(("", "باب")));
560
    assert_eq!(multi_byte_chars("باب", 1, 2), Ok(("ب", "با")));
561
    assert_eq!(
562
      multi_byte_chars("latin", 1, 64),
563
      Err(Err::Error(Error::new("latin", ErrorKind::TakeWhileMN)))
564
    );
565
  }
566
}