Coverage Report

Created: 2026-01-16 07:00

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/rust/registry/src/index.crates.io-1949cf8c6b5b557f/nom-8.0.0/src/sequence/mod.rs
Line
Count
Source
1
//! Combinators applying parsers in sequence
2
3
#[cfg(test)]
4
mod tests;
5
6
use crate::error::ParseError;
7
use crate::internal::{IResult, Parser};
8
use crate::{Check, OutputM, OutputMode, PResult};
9
10
/// Gets an object from the first parser,
11
/// then gets another object from the second parser.
12
///
13
/// # Arguments
14
/// * `first` The first parser to apply.
15
/// * `second` The second parser to apply.
16
///
17
/// # Example
18
/// ```rust
19
/// use nom::sequence::pair;
20
/// use nom::bytes::complete::tag;
21
/// use nom::{error::ErrorKind, Err, Parser};
22
///
23
/// let mut parser = pair(tag("abc"), tag("efg"));
24
///
25
/// assert_eq!(parser.parse("abcefg"), Ok(("", ("abc", "efg"))));
26
/// assert_eq!(parser.parse("abcefghij"), Ok(("hij", ("abc", "efg"))));
27
/// assert_eq!(parser.parse(""), Err(Err::Error(("", ErrorKind::Tag))));
28
/// assert_eq!(parser.parse("123"), Err(Err::Error(("123", ErrorKind::Tag))));
29
/// ```
30
159k
pub fn pair<I, O1, O2, E: ParseError<I>, F, G>(
31
159k
  first: F,
32
159k
  second: G,
33
159k
) -> impl Parser<I, Output = (O1, O2), Error = E>
34
159k
where
35
159k
  F: Parser<I, Output = O1, Error = E>,
36
159k
  G: Parser<I, Output = O2, Error = E>,
37
{
38
159k
  first.and(second)
39
159k
}
nom::sequence::pair::<&[u8], suricata::quic::frames::StreamTag, u32, suricata::quic::error::QuicError, suricata::quic::frames::parse_tag, nom::number::complete::le_u32<&[u8], suricata::quic::error::QuicError>>
Line
Count
Source
30
159k
pub fn pair<I, O1, O2, E: ParseError<I>, F, G>(
31
159k
  first: F,
32
159k
  second: G,
33
159k
) -> impl Parser<I, Output = (O1, O2), Error = E>
34
159k
where
35
159k
  F: Parser<I, Output = O1, Error = E>,
36
159k
  G: Parser<I, Output = O2, Error = E>,
37
{
38
159k
  first.and(second)
39
159k
}
Unexecuted instantiation: nom::sequence::pair::<&str, char, core::option::Option<&str>, nom::error::Error<&str>, nom::character::complete::char<&str, nom::error::Error<&str>>::{closure#0}, nom::combinator::Opt<nom::character::complete::digit1<&str, nom::error::Error<&str>>>>
Unexecuted instantiation: nom::sequence::pair::<_, _, _, _, _, _>
40
41
/// Matches an object from the first parser and discards it,
42
/// then gets an object from the second parser.
43
///
44
/// # Arguments
45
/// * `first` The opening parser.
46
/// * `second` The second parser to get object.
47
///
48
/// ```rust
49
/// # use nom::{Err, error::ErrorKind, Needed, Parser};
50
/// # use nom::Needed::Size;
51
/// use nom::sequence::preceded;
52
/// use nom::bytes::complete::tag;
53
///
54
/// let mut parser = preceded(tag("abc"), tag("efg"));
55
///
56
/// assert_eq!(parser.parse("abcefg"), Ok(("", "efg")));
57
/// assert_eq!(parser.parse("abcefghij"), Ok(("hij", "efg")));
58
/// assert_eq!(parser.parse(""), Err(Err::Error(("", ErrorKind::Tag))));
59
/// assert_eq!(parser.parse("123"), Err(Err::Error(("123", ErrorKind::Tag))));
60
/// ```
61
3.69M
pub fn preceded<I, O, E: ParseError<I>, F, G>(
62
3.69M
  first: F,
63
3.69M
  second: G,
64
3.69M
) -> impl Parser<I, Output = O, Error = E>
65
3.69M
where
66
3.69M
  F: Parser<I, Error = E>,
67
3.69M
  G: Parser<I, Output = O, Error = E>,
68
{
69
3.69M
  Preceded {
70
3.69M
    f: first,
71
3.69M
    g: second,
72
3.69M
  }
73
3.69M
}
nom::sequence::preceded::<&[u8], &str, nom::error::Error<&[u8]>, nom::character::complete::space1<&[u8], nom::error::Error<&[u8]>>, nom::internal::MapRes<nom::bytes::complete::take_while_m_n<suricata::sdp::parser::parse_media_description::{closure#4}, &[u8], nom::error::Error<&[u8]>>::{closure#0}, core::str::converts::from_utf8>>
Line
Count
Source
61
89.9k
pub fn preceded<I, O, E: ParseError<I>, F, G>(
62
89.9k
  first: F,
63
89.9k
  second: G,
64
89.9k
) -> impl Parser<I, Output = O, Error = E>
65
89.9k
where
66
89.9k
  F: Parser<I, Error = E>,
67
89.9k
  G: Parser<I, Output = O, Error = E>,
68
{
69
89.9k
  Preceded {
70
89.9k
    f: first,
71
89.9k
    g: second,
72
89.9k
  }
73
89.9k
}
nom::sequence::preceded::<&[u8], &str, nom::error::Error<&[u8]>, nom::bytes::complete::tag<&str, &[u8], nom::error::Error<&[u8]>>::{closure#0}, nom::internal::MapRes<nom::bytes::complete::take_till<suricata::sdp::parser::is_line_ending, &[u8], nom::error::Error<&[u8]>>::{closure#0}, core::str::converts::from_utf8>>
Line
Count
Source
61
247k
pub fn preceded<I, O, E: ParseError<I>, F, G>(
62
247k
  first: F,
63
247k
  second: G,
64
247k
) -> impl Parser<I, Output = O, Error = E>
65
247k
where
66
247k
  F: Parser<I, Error = E>,
67
247k
  G: Parser<I, Output = O, Error = E>,
68
{
69
247k
  Preceded {
70
247k
    f: first,
71
247k
    g: second,
72
247k
  }
73
247k
}
nom::sequence::preceded::<&[u8], &str, nom::error::Error<&[u8]>, nom::character::complete::char<&[u8], nom::error::Error<&[u8]>>::{closure#0}, nom::internal::MapRes<nom::bytes::complete::take_while_m_n<suricata::sdp::parser::parse_media_description::{closure#2}, &[u8], nom::error::Error<&[u8]>>::{closure#0}, core::str::converts::from_utf8>>
Line
Count
Source
61
93.1k
pub fn preceded<I, O, E: ParseError<I>, F, G>(
62
93.1k
  first: F,
63
93.1k
  second: G,
64
93.1k
) -> impl Parser<I, Output = O, Error = E>
65
93.1k
where
66
93.1k
  F: Parser<I, Error = E>,
67
93.1k
  G: Parser<I, Output = O, Error = E>,
68
{
69
93.1k
  Preceded {
70
93.1k
    f: first,
71
93.1k
    g: second,
72
93.1k
  }
73
93.1k
}
nom::sequence::preceded::<&[u8], &str, nom::error::Error<&[u8]>, nom::character::complete::char<&[u8], nom::error::Error<&[u8]>>::{closure#0}, nom::internal::MapRes<nom::bytes::complete::take_till<suricata::sdp::parser::is_line_ending, &[u8], nom::error::Error<&[u8]>>::{closure#0}, core::str::converts::from_utf8>>
Line
Count
Source
61
112k
pub fn preceded<I, O, E: ParseError<I>, F, G>(
62
112k
  first: F,
63
112k
  second: G,
64
112k
) -> impl Parser<I, Output = O, Error = E>
65
112k
where
66
112k
  F: Parser<I, Error = E>,
67
112k
  G: Parser<I, Output = O, Error = E>,
68
{
69
112k
  Preceded {
70
112k
    f: first,
71
112k
    g: second,
72
112k
  }
73
112k
}
nom::sequence::preceded::<&[u8], (&str, &[u8], &str, &[u8], &str, &[u8], &str), nom::error::Error<&[u8]>, nom::bytes::complete::tag<&str, &[u8], nom::error::Error<&[u8]>>::{closure#0}, (nom::internal::MapRes<nom::bytes::complete::take_while<suricata::sdp::parser::is_time_char, &[u8], nom::error::Error<&[u8]>>::{closure#0}, core::str::converts::from_utf8>, nom::character::complete::space1<&[u8], nom::error::Error<&[u8]>>, nom::internal::MapRes<nom::bytes::complete::take_while<suricata::sdp::parser::is_time_char, &[u8], nom::error::Error<&[u8]>>::{closure#0}, core::str::converts::from_utf8>, nom::character::complete::space1<&[u8], nom::error::Error<&[u8]>>, nom::internal::MapRes<nom::bytes::complete::take_while<suricata::sdp::parser::is_time_char, &[u8], nom::error::Error<&[u8]>>::{closure#0}, core::str::converts::from_utf8>, nom::character::complete::space1<&[u8], nom::error::Error<&[u8]>>, nom::internal::MapRes<nom::bytes::complete::take_while<suricata::sdp::parser::is_time_char, &[u8], nom::error::Error<&[u8]>>::{closure#0}, core::str::converts::from_utf8>)>
Line
Count
Source
61
503k
pub fn preceded<I, O, E: ParseError<I>, F, G>(
62
503k
  first: F,
63
503k
  second: G,
64
503k
) -> impl Parser<I, Output = O, Error = E>
65
503k
where
66
503k
  F: Parser<I, Error = E>,
67
503k
  G: Parser<I, Output = O, Error = E>,
68
{
69
503k
  Preceded {
70
503k
    f: first,
71
503k
    g: second,
72
503k
  }
73
503k
}
nom::sequence::preceded::<&[u8], (&str, &[u8], &str), nom::error::Error<&[u8]>, nom::bytes::complete::tag<&str, &[u8], nom::error::Error<&[u8]>>::{closure#0}, (nom::internal::MapRes<nom::character::complete::digit1<&[u8], nom::error::Error<&[u8]>>, core::str::converts::from_utf8>, nom::character::complete::space1<&[u8], nom::error::Error<&[u8]>>, nom::internal::MapRes<nom::character::complete::digit1<&[u8], nom::error::Error<&[u8]>>, core::str::converts::from_utf8>)>
Line
Count
Source
61
546k
pub fn preceded<I, O, E: ParseError<I>, F, G>(
62
546k
  first: F,
63
546k
  second: G,
64
546k
) -> impl Parser<I, Output = O, Error = E>
65
546k
where
66
546k
  F: Parser<I, Error = E>,
67
546k
  G: Parser<I, Output = O, Error = E>,
68
{
69
546k
  Preceded {
70
546k
    f: first,
71
546k
    g: second,
72
546k
  }
73
546k
}
nom::sequence::preceded::<&[u8], (&str, core::option::Option<&str>, &[u8]), nom::error::Error<&[u8]>, nom::bytes::complete::tag<&str, &[u8], nom::error::Error<&[u8]>>::{closure#0}, (nom::internal::MapRes<nom::bytes::complete::take_while<suricata::sdp::parser::parse_attributes::{closure#0}, &[u8], nom::error::Error<&[u8]>>::{closure#0}, core::str::converts::from_utf8>, nom::combinator::Opt<nom::sequence::Preceded<nom::character::complete::char<&[u8], nom::error::Error<&[u8]>>::{closure#0}, nom::internal::MapRes<nom::bytes::complete::take_till<suricata::sdp::parser::is_line_ending, &[u8], nom::error::Error<&[u8]>>::{closure#0}, core::str::converts::from_utf8>>>, nom::character::complete::line_ending<&[u8], nom::error::Error<&[u8]>>)>
Line
Count
Source
61
112k
pub fn preceded<I, O, E: ParseError<I>, F, G>(
62
112k
  first: F,
63
112k
  second: G,
64
112k
) -> impl Parser<I, Output = O, Error = E>
65
112k
where
66
112k
  F: Parser<I, Error = E>,
67
112k
  G: Parser<I, Output = O, Error = E>,
68
{
69
112k
  Preceded {
70
112k
    f: first,
71
112k
    g: second,
72
112k
  }
73
112k
}
nom::sequence::preceded::<&[u8], (&str, char, &str, &[u8]), nom::error::Error<&[u8]>, nom::bytes::complete::tag<&str, &[u8], nom::error::Error<&[u8]>>::{closure#0}, (nom::internal::MapRes<nom::branch::Choice<(nom::bytes::complete::tag<&str, &[u8], nom::error::Error<&[u8]>>::{closure#0}, nom::bytes::complete::tag<&str, &[u8], nom::error::Error<&[u8]>>::{closure#0}, nom::bytes::complete::tag<&str, &[u8], nom::error::Error<&[u8]>>::{closure#0})>, core::str::converts::from_utf8>, nom::character::complete::char<&[u8], nom::error::Error<&[u8]>>::{closure#0}, nom::internal::MapRes<nom::character::complete::digit1<&[u8], nom::error::Error<&[u8]>>, core::str::converts::from_utf8>, nom::character::complete::line_ending<&[u8], nom::error::Error<&[u8]>>)>
Line
Count
Source
61
155k
pub fn preceded<I, O, E: ParseError<I>, F, G>(
62
155k
  first: F,
63
155k
  second: G,
64
155k
) -> impl Parser<I, Output = O, Error = E>
65
155k
where
66
155k
  F: Parser<I, Error = E>,
67
155k
  G: Parser<I, Output = O, Error = E>,
68
{
69
155k
  Preceded {
70
155k
    f: first,
71
155k
    g: second,
72
155k
  }
73
155k
}
nom::sequence::preceded::<&[u8], u8, nom::error::Error<&[u8]>, nom::combinator::Verify<nom::combinator::Peek<nom::number::complete::be_u8<&[u8], nom::error::Error<&[u8]>>>, suricata::sdp::parser::parse_num::{closure#0}, u8>, nom::character::complete::u8<&[u8], nom::error::Error<&[u8]>>>
Line
Count
Source
61
4.91k
pub fn preceded<I, O, E: ParseError<I>, F, G>(
62
4.91k
  first: F,
63
4.91k
  second: G,
64
4.91k
) -> impl Parser<I, Output = O, Error = E>
65
4.91k
where
66
4.91k
  F: Parser<I, Error = E>,
67
4.91k
  G: Parser<I, Output = O, Error = E>,
68
{
69
4.91k
  Preceded {
70
4.91k
    f: first,
71
4.91k
    g: second,
72
4.91k
  }
73
4.91k
}
nom::sequence::preceded::<&[u8], u8, nom::error::Error<&[u8]>, nom::character::complete::char<&[u8], nom::error::Error<&[u8]>>::{closure#0}, suricata::sdp::parser::parse_num>
Line
Count
Source
61
20.0k
pub fn preceded<I, O, E: ParseError<I>, F, G>(
62
20.0k
  first: F,
63
20.0k
  second: G,
64
20.0k
) -> impl Parser<I, Output = O, Error = E>
65
20.0k
where
66
20.0k
  F: Parser<I, Error = E>,
67
20.0k
  G: Parser<I, Output = O, Error = E>,
68
{
69
20.0k
  Preceded {
70
20.0k
    f: first,
71
20.0k
    g: second,
72
20.0k
  }
73
20.0k
}
nom::sequence::preceded::<&str, &str, nom::error::Error<&str>, nom::character::complete::multispace0<&str, nom::error::Error<&str>>, nom::bytes::complete::take_while<suricata::detect::requires::parse_key_value::{closure#0}, &str, nom::error::Error<&str>>::{closure#0}>
Line
Count
Source
61
43.1k
pub fn preceded<I, O, E: ParseError<I>, F, G>(
62
43.1k
  first: F,
63
43.1k
  second: G,
64
43.1k
) -> impl Parser<I, Output = O, Error = E>
65
43.1k
where
66
43.1k
  F: Parser<I, Error = E>,
67
43.1k
  G: Parser<I, Output = O, Error = E>,
68
{
69
43.1k
  Preceded {
70
43.1k
    f: first,
71
43.1k
    g: second,
72
43.1k
  }
73
43.1k
}
nom::sequence::preceded::<&str, &str, nom::error::Error<&str>, nom::character::complete::multispace0<&str, nom::error::Error<&str>>, nom::bytes::complete::tag<&str, &str, nom::error::Error<&str>>::{closure#0}>
Line
Count
Source
61
13.9k
pub fn preceded<I, O, E: ParseError<I>, F, G>(
62
13.9k
  first: F,
63
13.9k
  second: G,
64
13.9k
) -> impl Parser<I, Output = O, Error = E>
65
13.9k
where
66
13.9k
  F: Parser<I, Error = E>,
67
13.9k
  G: Parser<I, Output = O, Error = E>,
68
{
69
13.9k
  Preceded {
70
13.9k
    f: first,
71
13.9k
    g: second,
72
13.9k
  }
73
13.9k
}
nom::sequence::preceded::<&str, &str, nom::error::Error<&str>, nom::character::complete::multispace0<&str, nom::error::Error<&str>>, nom::bytes::complete::take_till<suricata::detect::requires::parse_key_value::{closure#1}, &str, nom::error::Error<&str>>::{closure#0}>
Line
Count
Source
61
43.1k
pub fn preceded<I, O, E: ParseError<I>, F, G>(
62
43.1k
  first: F,
63
43.1k
  second: G,
64
43.1k
) -> impl Parser<I, Output = O, Error = E>
65
43.1k
where
66
43.1k
  F: Parser<I, Error = E>,
67
43.1k
  G: Parser<I, Output = O, Error = E>,
68
{
69
43.1k
  Preceded {
70
43.1k
    f: first,
71
43.1k
    g: second,
72
43.1k
  }
73
43.1k
}
nom::sequence::preceded::<&str, suricata::detect::requires::VersionCompareOp, nom::error::Error<&str>, nom::character::complete::multispace0<&str, nom::error::Error<&str>>, nom::branch::Choice<(nom::internal::Map<nom::bytes::complete::tag<&str, &str, nom::error::Error<&str>>::{closure#0}, suricata::detect::requires::parse_op::{closure#0}>, nom::internal::Map<nom::bytes::complete::tag<&str, &str, nom::error::Error<&str>>::{closure#0}, suricata::detect::requires::parse_op::{closure#1}>, nom::internal::Map<nom::bytes::complete::tag<&str, &str, nom::error::Error<&str>>::{closure#0}, suricata::detect::requires::parse_op::{closure#2}>, nom::internal::Map<nom::bytes::complete::tag<&str, &str, nom::error::Error<&str>>::{closure#0}, suricata::detect::requires::parse_op::{closure#3}>)>>
Line
Count
Source
61
57.2k
pub fn preceded<I, O, E: ParseError<I>, F, G>(
62
57.2k
  first: F,
63
57.2k
  second: G,
64
57.2k
) -> impl Parser<I, Output = O, Error = E>
65
57.2k
where
66
57.2k
  F: Parser<I, Error = E>,
67
57.2k
  G: Parser<I, Output = O, Error = E>,
68
{
69
57.2k
  Preceded {
70
57.2k
    f: first,
71
57.2k
    g: second,
72
57.2k
  }
73
57.2k
}
nom::sequence::preceded::<&str, u8, nom::error::Error<&str>, nom::character::complete::multispace0<&str, nom::error::Error<&str>>, suricata::detect::requires::parse_next_version_part>
Line
Count
Source
61
54.6k
pub fn preceded<I, O, E: ParseError<I>, F, G>(
62
54.6k
  first: F,
63
54.6k
  second: G,
64
54.6k
) -> impl Parser<I, Output = O, Error = E>
65
54.6k
where
66
54.6k
  F: Parser<I, Error = E>,
67
54.6k
  G: Parser<I, Output = O, Error = E>,
68
{
69
54.6k
  Preceded {
70
54.6k
    f: first,
71
54.6k
    g: second,
72
54.6k
  }
73
54.6k
}
nom::sequence::preceded::<&str, u8, nom::error::Error<&str>, nom::character::complete::char<&str, nom::error::Error<&str>>::{closure#0}, suricata::detect::requires::parse_next_version_part>
Line
Count
Source
61
63.0k
pub fn preceded<I, O, E: ParseError<I>, F, G>(
62
63.0k
  first: F,
63
63.0k
  second: G,
64
63.0k
) -> impl Parser<I, Output = O, Error = E>
65
63.0k
where
66
63.0k
  F: Parser<I, Error = E>,
67
63.0k
  G: Parser<I, Output = O, Error = E>,
68
{
69
63.0k
  Preceded {
70
63.0k
    f: first,
71
63.0k
    g: second,
72
63.0k
  }
73
63.0k
}
nom::sequence::preceded::<&[u8], &[u8], nom::error::Error<&[u8]>, nom::character::complete::multispace0<&[u8], nom::error::Error<&[u8]>>, nom::sequence::Terminated<nom::character::complete::digit1<&[u8], nom::error::Error<&[u8]>>, nom::character::complete::multispace0<&[u8], nom::error::Error<&[u8]>>>>
Line
Count
Source
61
378k
pub fn preceded<I, O, E: ParseError<I>, F, G>(
62
378k
  first: F,
63
378k
  second: G,
64
378k
) -> impl Parser<I, Output = O, Error = E>
65
378k
where
66
378k
  F: Parser<I, Error = E>,
67
378k
  G: Parser<I, Output = O, Error = E>,
68
{
69
378k
  Preceded {
70
378k
    f: first,
71
378k
    g: second,
72
378k
  }
73
378k
}
nom::sequence::preceded::<&[u8], char, nom::error::Error<&[u8]>, nom::bytes::streaming::take_while<suricata::sip::parser::hcolon::{closure#0}, &[u8], nom::error::Error<&[u8]>>::{closure#0}, nom::sequence::Terminated<nom::character::streaming::char<&[u8], nom::error::Error<&[u8]>>::{closure#0}, nom::bytes::streaming::take_while<suricata::sip::parser::hcolon::{closure#1}, &[u8], nom::error::Error<&[u8]>>::{closure#0}>>
Line
Count
Source
61
905k
pub fn preceded<I, O, E: ParseError<I>, F, G>(
62
905k
  first: F,
63
905k
  second: G,
64
905k
) -> impl Parser<I, Output = O, Error = E>
65
905k
where
66
905k
  F: Parser<I, Error = E>,
67
905k
  G: Parser<I, Output = O, Error = E>,
68
{
69
905k
  Preceded {
70
905k
    f: first,
71
905k
    g: second,
72
905k
  }
73
905k
}
nom::sequence::preceded::<&str, &str, suricata::detect::error::RuleParseError<&str>, nom::character::complete::multispace0<&str, suricata::detect::error::RuleParseError<&str>>, nom::bytes::complete::is_not<&str, &str, suricata::detect::error::RuleParseError<&str>>::{closure#0}>
Line
Count
Source
61
239k
pub fn preceded<I, O, E: ParseError<I>, F, G>(
62
239k
  first: F,
63
239k
  second: G,
64
239k
) -> impl Parser<I, Output = O, Error = E>
65
239k
where
66
239k
  F: Parser<I, Error = E>,
67
239k
  G: Parser<I, Output = O, Error = E>,
68
{
69
239k
  Preceded {
70
239k
    f: first,
71
239k
    g: second,
72
239k
  }
73
239k
}
Unexecuted instantiation: nom::sequence::preceded::<&str, &str, nom::error::Error<&str>, nom::character::complete::multispace0<&str, nom::error::Error<&str>>, nom::combinator::Verify<nom::character::complete::not_line_ending<&str, nom::error::Error<&str>>, suricata::conf::get_memval::{closure#0}, str>>
Unexecuted instantiation: nom::sequence::preceded::<&str, f64, nom::error::Error<&str>, nom::character::complete::multispace0<&str, nom::error::Error<&str>>, nom::number::complete::double<&str, nom::error::Error<&str>>>
nom::sequence::preceded::<&str, i32, nom::error::Error<&str>, nom::character::complete::multispace1<&str, nom::error::Error<&str>>, nom::combinator::Verify<suricata::asn1::parse_rules::parse_i32_number, suricata::asn1::parse_rules::asn1_parse_rule::relative_offset::{closure#0}, i32>>
Line
Count
Source
61
3.13k
pub fn preceded<I, O, E: ParseError<I>, F, G>(
62
3.13k
  first: F,
63
3.13k
  second: G,
64
3.13k
) -> impl Parser<I, Output = O, Error = E>
65
3.13k
where
66
3.13k
  F: Parser<I, Error = E>,
67
3.13k
  G: Parser<I, Output = O, Error = E>,
68
{
69
3.13k
  Preceded {
70
3.13k
    f: first,
71
3.13k
    g: second,
72
3.13k
  }
73
3.13k
}
nom::sequence::preceded::<&str, u32, nom::error::Error<&str>, nom::character::complete::multispace1<&str, nom::error::Error<&str>>, suricata::asn1::parse_rules::parse_u32_number>
Line
Count
Source
61
3.13k
pub fn preceded<I, O, E: ParseError<I>, F, G>(
62
3.13k
  first: F,
63
3.13k
  second: G,
64
3.13k
) -> impl Parser<I, Output = O, Error = E>
65
3.13k
where
66
3.13k
  F: Parser<I, Error = E>,
67
3.13k
  G: Parser<I, Output = O, Error = E>,
68
{
69
3.13k
  Preceded {
70
3.13k
    f: first,
71
3.13k
    g: second,
72
3.13k
  }
73
3.13k
}
nom::sequence::preceded::<&str, u16, nom::error::Error<&str>, nom::character::complete::multispace1<&str, nom::error::Error<&str>>, suricata::asn1::parse_rules::parse_u16_number>
Line
Count
Source
61
3.13k
pub fn preceded<I, O, E: ParseError<I>, F, G>(
62
3.13k
  first: F,
63
3.13k
  second: G,
64
3.13k
) -> impl Parser<I, Output = O, Error = E>
65
3.13k
where
66
3.13k
  F: Parser<I, Error = E>,
67
3.13k
  G: Parser<I, Output = O, Error = E>,
68
{
69
3.13k
  Preceded {
70
3.13k
    f: first,
71
3.13k
    g: second,
72
3.13k
  }
73
3.13k
}
Unexecuted instantiation: nom::sequence::preceded::<_, _, _, _, _>
74
75
/// a
76
pub struct Preceded<F, G> {
77
  f: F,
78
  g: G,
79
}
80
81
impl<I, E: ParseError<I>, F: Parser<I, Error = E>, G: Parser<I, Error = E>> Parser<I>
82
  for Preceded<F, G>
83
{
84
  type Output = <G as Parser<I>>::Output;
85
  type Error = E;
86
87
  #[inline(always)]
88
9.72M
  fn process<OM: OutputMode>(&mut self, i: I) -> PResult<OM, I, Self::Output, Self::Error> {
89
9.72M
    let (i, _) = self
90
9.72M
      .f
91
9.72M
      .process::<OutputM<Check, OM::Error, OM::Incomplete>>(i)?;
92
7.58M
    let (i, o2) = self.g.process::<OM>(i)?;
93
94
7.50M
    Ok((i, o2))
95
9.72M
  }
<nom::sequence::Preceded<nom::combinator::Verify<nom::combinator::Peek<nom::number::complete::be_u8<&[u8], nom::error::Error<&[u8]>>>, suricata::sdp::parser::parse_num::{closure#0}, u8>, nom::character::complete::u8<&[u8], nom::error::Error<&[u8]>>> as nom::internal::Parser<&[u8]>>::process::<nom::internal::OutputM<nom::internal::Emit, nom::internal::Emit, nom::internal::Streaming>>
Line
Count
Source
88
4.91k
  fn process<OM: OutputMode>(&mut self, i: I) -> PResult<OM, I, Self::Output, Self::Error> {
89
4.91k
    let (i, _) = self
90
4.91k
      .f
91
4.91k
      .process::<OutputM<Check, OM::Error, OM::Incomplete>>(i)?;
92
3.73k
    let (i, o2) = self.g.process::<OM>(i)?;
93
94
2.05k
    Ok((i, o2))
95
4.91k
  }
<nom::sequence::Preceded<nom::character::complete::multispace0<&[u8], nom::error::Error<&[u8]>>, nom::sequence::Terminated<nom::character::complete::digit1<&[u8], nom::error::Error<&[u8]>>, nom::character::complete::multispace0<&[u8], nom::error::Error<&[u8]>>>> as nom::internal::Parser<&[u8]>>::process::<nom::internal::OutputM<nom::internal::Emit, nom::internal::Emit, nom::internal::Streaming>>
Line
Count
Source
88
378k
  fn process<OM: OutputMode>(&mut self, i: I) -> PResult<OM, I, Self::Output, Self::Error> {
89
378k
    let (i, _) = self
90
378k
      .f
91
378k
      .process::<OutputM<Check, OM::Error, OM::Incomplete>>(i)?;
92
378k
    let (i, o2) = self.g.process::<OM>(i)?;
93
94
368k
    Ok((i, o2))
95
378k
  }
<nom::sequence::Preceded<nom::character::complete::multispace0<&str, nom::error::Error<&str>>, nom::branch::Choice<(nom::internal::Map<nom::bytes::complete::tag<&str, &str, nom::error::Error<&str>>::{closure#0}, suricata::detect::requires::parse_op::{closure#0}>, nom::internal::Map<nom::bytes::complete::tag<&str, &str, nom::error::Error<&str>>::{closure#0}, suricata::detect::requires::parse_op::{closure#1}>, nom::internal::Map<nom::bytes::complete::tag<&str, &str, nom::error::Error<&str>>::{closure#0}, suricata::detect::requires::parse_op::{closure#2}>, nom::internal::Map<nom::bytes::complete::tag<&str, &str, nom::error::Error<&str>>::{closure#0}, suricata::detect::requires::parse_op::{closure#3}>)>> as nom::internal::Parser<&str>>::process::<nom::internal::OutputM<nom::internal::Emit, nom::internal::Emit, nom::internal::Streaming>>
Line
Count
Source
88
57.2k
  fn process<OM: OutputMode>(&mut self, i: I) -> PResult<OM, I, Self::Output, Self::Error> {
89
57.2k
    let (i, _) = self
90
57.2k
      .f
91
57.2k
      .process::<OutputM<Check, OM::Error, OM::Incomplete>>(i)?;
92
57.2k
    let (i, o2) = self.g.process::<OM>(i)?;
93
94
35.8k
    Ok((i, o2))
95
57.2k
  }
<nom::sequence::Preceded<nom::character::complete::multispace0<&str, nom::error::Error<&str>>, nom::bytes::complete::take_while<suricata::detect::requires::parse_key_value::{closure#0}, &str, nom::error::Error<&str>>::{closure#0}> as nom::internal::Parser<&str>>::process::<nom::internal::OutputM<nom::internal::Emit, nom::internal::Emit, nom::internal::Streaming>>
Line
Count
Source
88
43.1k
  fn process<OM: OutputMode>(&mut self, i: I) -> PResult<OM, I, Self::Output, Self::Error> {
89
43.1k
    let (i, _) = self
90
43.1k
      .f
91
43.1k
      .process::<OutputM<Check, OM::Error, OM::Incomplete>>(i)?;
92
43.1k
    let (i, o2) = self.g.process::<OM>(i)?;
93
94
43.1k
    Ok((i, o2))
95
43.1k
  }
<nom::sequence::Preceded<nom::character::complete::multispace0<&str, nom::error::Error<&str>>, nom::bytes::complete::tag<&str, &str, nom::error::Error<&str>>::{closure#0}> as nom::internal::Parser<&str>>::process::<nom::internal::OutputM<nom::internal::Check, nom::internal::Check, nom::internal::Streaming>>
Line
Count
Source
88
22.2k
  fn process<OM: OutputMode>(&mut self, i: I) -> PResult<OM, I, Self::Output, Self::Error> {
89
22.2k
    let (i, _) = self
90
22.2k
      .f
91
22.2k
      .process::<OutputM<Check, OM::Error, OM::Incomplete>>(i)?;
92
22.2k
    let (i, o2) = self.g.process::<OM>(i)?;
93
94
11.5k
    Ok((i, o2))
95
22.2k
  }
<nom::sequence::Preceded<nom::character::complete::multispace0<&str, nom::error::Error<&str>>, nom::bytes::complete::take_till<suricata::detect::requires::parse_key_value::{closure#1}, &str, nom::error::Error<&str>>::{closure#0}> as nom::internal::Parser<&str>>::process::<nom::internal::OutputM<nom::internal::Emit, nom::internal::Emit, nom::internal::Streaming>>
Line
Count
Source
88
43.1k
  fn process<OM: OutputMode>(&mut self, i: I) -> PResult<OM, I, Self::Output, Self::Error> {
89
43.1k
    let (i, _) = self
90
43.1k
      .f
91
43.1k
      .process::<OutputM<Check, OM::Error, OM::Incomplete>>(i)?;
92
43.1k
    let (i, o2) = self.g.process::<OM>(i)?;
93
94
43.1k
    Ok((i, o2))
95
43.1k
  }
<nom::sequence::Preceded<nom::character::complete::multispace0<&str, nom::error::Error<&str>>, suricata::detect::requires::parse_next_version_part> as nom::internal::Parser<&str>>::process::<nom::internal::OutputM<nom::internal::Emit, nom::internal::Emit, nom::internal::Streaming>>
Line
Count
Source
88
54.6k
  fn process<OM: OutputMode>(&mut self, i: I) -> PResult<OM, I, Self::Output, Self::Error> {
89
54.6k
    let (i, _) = self
90
54.6k
      .f
91
54.6k
      .process::<OutputM<Check, OM::Error, OM::Incomplete>>(i)?;
92
54.6k
    let (i, o2) = self.g.process::<OM>(i)?;
93
94
52.6k
    Ok((i, o2))
95
54.6k
  }
<nom::sequence::Preceded<nom::character::complete::multispace0<&str, suricata::detect::error::RuleParseError<&str>>, nom::bytes::complete::is_not<&str, &str, suricata::detect::error::RuleParseError<&str>>::{closure#0}> as nom::internal::Parser<&str>>::process::<nom::internal::OutputM<nom::internal::Emit, nom::internal::Emit, nom::internal::Streaming>>
Line
Count
Source
88
239k
  fn process<OM: OutputMode>(&mut self, i: I) -> PResult<OM, I, Self::Output, Self::Error> {
89
239k
    let (i, _) = self
90
239k
      .f
91
239k
      .process::<OutputM<Check, OM::Error, OM::Incomplete>>(i)?;
92
239k
    let (i, o2) = self.g.process::<OM>(i)?;
93
94
239k
    Ok((i, o2))
95
239k
  }
<nom::sequence::Preceded<nom::character::complete::multispace0<&str, suricata::detect::error::RuleParseError<&str>>, nom::bytes::complete::is_not<&str, &str, suricata::detect::error::RuleParseError<&str>>::{closure#0}> as nom::internal::Parser<&str>>::process::<nom::internal::OutputM<nom::internal::Emit, nom::internal::Check, nom::internal::Streaming>>
Line
Count
Source
88
454k
  fn process<OM: OutputMode>(&mut self, i: I) -> PResult<OM, I, Self::Output, Self::Error> {
89
454k
    let (i, _) = self
90
454k
      .f
91
454k
      .process::<OutputM<Check, OM::Error, OM::Incomplete>>(i)?;
92
454k
    let (i, o2) = self.g.process::<OM>(i)?;
93
94
452k
    Ok((i, o2))
95
454k
  }
<nom::sequence::Preceded<nom::character::complete::space1<&[u8], nom::error::Error<&[u8]>>, nom::internal::MapRes<nom::bytes::complete::take_while_m_n<suricata::sdp::parser::parse_media_description::{closure#4}, &[u8], nom::error::Error<&[u8]>>::{closure#0}, core::str::converts::from_utf8>> as nom::internal::Parser<&[u8]>>::process::<nom::internal::OutputM<nom::internal::Emit, nom::internal::Emit, nom::internal::Streaming>>
Line
Count
Source
88
89.9k
  fn process<OM: OutputMode>(&mut self, i: I) -> PResult<OM, I, Self::Output, Self::Error> {
89
89.9k
    let (i, _) = self
90
89.9k
      .f
91
89.9k
      .process::<OutputM<Check, OM::Error, OM::Incomplete>>(i)?;
92
89.6k
    let (i, o2) = self.g.process::<OM>(i)?;
93
94
89.1k
    Ok((i, o2))
95
89.9k
  }
<nom::sequence::Preceded<nom::character::complete::space1<&[u8], nom::error::Error<&[u8]>>, nom::internal::MapRes<nom::bytes::complete::take_while_m_n<suricata::sdp::parser::parse_media_description::{closure#4}, &[u8], nom::error::Error<&[u8]>>::{closure#0}, core::str::converts::from_utf8>> as nom::internal::Parser<&[u8]>>::process::<nom::internal::OutputM<nom::internal::Emit, nom::internal::Check, nom::internal::Streaming>>
Line
Count
Source
88
2.80M
  fn process<OM: OutputMode>(&mut self, i: I) -> PResult<OM, I, Self::Output, Self::Error> {
89
2.80M
    let (i, _) = self
90
2.80M
      .f
91
2.80M
      .process::<OutputM<Check, OM::Error, OM::Incomplete>>(i)?;
92
2.71M
    let (i, o2) = self.g.process::<OM>(i)?;
93
94
2.71M
    Ok((i, o2))
95
2.80M
  }
<nom::sequence::Preceded<nom::bytes::complete::tag<&str, &[u8], nom::error::Error<&[u8]>>::{closure#0}, nom::internal::MapRes<nom::bytes::complete::take_till<suricata::sdp::parser::is_line_ending, &[u8], nom::error::Error<&[u8]>>::{closure#0}, core::str::converts::from_utf8>> as nom::internal::Parser<&[u8]>>::process::<nom::internal::OutputM<nom::internal::Emit, nom::internal::Emit, nom::internal::Streaming>>
Line
Count
Source
88
247k
  fn process<OM: OutputMode>(&mut self, i: I) -> PResult<OM, I, Self::Output, Self::Error> {
89
247k
    let (i, _) = self
90
247k
      .f
91
247k
      .process::<OutputM<Check, OM::Error, OM::Incomplete>>(i)?;
92
6.63k
    let (i, o2) = self.g.process::<OM>(i)?;
93
94
5.67k
    Ok((i, o2))
95
247k
  }
<nom::sequence::Preceded<nom::bytes::complete::tag<&str, &[u8], nom::error::Error<&[u8]>>::{closure#0}, (nom::internal::MapRes<nom::branch::Choice<(nom::bytes::complete::tag<&str, &[u8], nom::error::Error<&[u8]>>::{closure#0}, nom::bytes::complete::tag<&str, &[u8], nom::error::Error<&[u8]>>::{closure#0}, nom::bytes::complete::tag<&str, &[u8], nom::error::Error<&[u8]>>::{closure#0})>, core::str::converts::from_utf8>, nom::character::complete::char<&[u8], nom::error::Error<&[u8]>>::{closure#0}, nom::internal::MapRes<nom::character::complete::digit1<&[u8], nom::error::Error<&[u8]>>, core::str::converts::from_utf8>, nom::character::complete::line_ending<&[u8], nom::error::Error<&[u8]>>)> as nom::internal::Parser<&[u8]>>::process::<nom::internal::OutputM<nom::internal::Emit, nom::internal::Check, nom::internal::Streaming>>
Line
Count
Source
88
776k
  fn process<OM: OutputMode>(&mut self, i: I) -> PResult<OM, I, Self::Output, Self::Error> {
89
776k
    let (i, _) = self
90
776k
      .f
91
776k
      .process::<OutputM<Check, OM::Error, OM::Incomplete>>(i)?;
92
635k
    let (i, o2) = self.g.process::<OM>(i)?;
93
94
621k
    Ok((i, o2))
95
776k
  }
<nom::sequence::Preceded<nom::bytes::complete::tag<&str, &[u8], nom::error::Error<&[u8]>>::{closure#0}, (nom::internal::MapRes<nom::character::complete::digit1<&[u8], nom::error::Error<&[u8]>>, core::str::converts::from_utf8>, nom::character::complete::space1<&[u8], nom::error::Error<&[u8]>>, nom::internal::MapRes<nom::character::complete::digit1<&[u8], nom::error::Error<&[u8]>>, core::str::converts::from_utf8>)> as nom::internal::Parser<&[u8]>>::process::<nom::internal::OutputM<nom::internal::Emit, nom::internal::Emit, nom::internal::Streaming>>
Line
Count
Source
88
546k
  fn process<OM: OutputMode>(&mut self, i: I) -> PResult<OM, I, Self::Output, Self::Error> {
89
546k
    let (i, _) = self
90
546k
      .f
91
546k
      .process::<OutputM<Check, OM::Error, OM::Incomplete>>(i)?;
92
480k
    let (i, o2) = self.g.process::<OM>(i)?;
93
94
479k
    Ok((i, o2))
95
546k
  }
<nom::sequence::Preceded<nom::bytes::complete::tag<&str, &[u8], nom::error::Error<&[u8]>>::{closure#0}, (nom::internal::MapRes<nom::bytes::complete::take_while<suricata::sdp::parser::parse_attributes::{closure#0}, &[u8], nom::error::Error<&[u8]>>::{closure#0}, core::str::converts::from_utf8>, nom::combinator::Opt<nom::sequence::Preceded<nom::character::complete::char<&[u8], nom::error::Error<&[u8]>>::{closure#0}, nom::internal::MapRes<nom::bytes::complete::take_till<suricata::sdp::parser::is_line_ending, &[u8], nom::error::Error<&[u8]>>::{closure#0}, core::str::converts::from_utf8>>>, nom::character::complete::line_ending<&[u8], nom::error::Error<&[u8]>>)> as nom::internal::Parser<&[u8]>>::process::<nom::internal::OutputM<nom::internal::Emit, nom::internal::Check, nom::internal::Streaming>>
Line
Count
Source
88
1.24M
  fn process<OM: OutputMode>(&mut self, i: I) -> PResult<OM, I, Self::Output, Self::Error> {
89
1.24M
    let (i, _) = self
90
1.24M
      .f
91
1.24M
      .process::<OutputM<Check, OM::Error, OM::Incomplete>>(i)?;
92
1.13M
    let (i, o2) = self.g.process::<OM>(i)?;
93
94
1.13M
    Ok((i, o2))
95
1.24M
  }
<nom::sequence::Preceded<nom::bytes::complete::tag<&str, &[u8], nom::error::Error<&[u8]>>::{closure#0}, (nom::internal::MapRes<nom::bytes::complete::take_while<suricata::sdp::parser::is_time_char, &[u8], nom::error::Error<&[u8]>>::{closure#0}, core::str::converts::from_utf8>, nom::character::complete::space1<&[u8], nom::error::Error<&[u8]>>, nom::internal::MapRes<nom::bytes::complete::take_while<suricata::sdp::parser::is_time_char, &[u8], nom::error::Error<&[u8]>>::{closure#0}, core::str::converts::from_utf8>, nom::character::complete::space1<&[u8], nom::error::Error<&[u8]>>, nom::internal::MapRes<nom::bytes::complete::take_while<suricata::sdp::parser::is_time_char, &[u8], nom::error::Error<&[u8]>>::{closure#0}, core::str::converts::from_utf8>, nom::character::complete::space1<&[u8], nom::error::Error<&[u8]>>, nom::internal::MapRes<nom::bytes::complete::take_while<suricata::sdp::parser::is_time_char, &[u8], nom::error::Error<&[u8]>>::{closure#0}, core::str::converts::from_utf8>)> as nom::internal::Parser<&[u8]>>::process::<nom::internal::OutputM<nom::internal::Emit, nom::internal::Emit, nom::internal::Streaming>>
Line
Count
Source
88
503k
  fn process<OM: OutputMode>(&mut self, i: I) -> PResult<OM, I, Self::Output, Self::Error> {
89
503k
    let (i, _) = self
90
503k
      .f
91
503k
      .process::<OutputM<Check, OM::Error, OM::Incomplete>>(i)?;
92
47.1k
    let (i, o2) = self.g.process::<OM>(i)?;
93
94
44.7k
    Ok((i, o2))
95
503k
  }
<nom::sequence::Preceded<nom::character::complete::char<&[u8], nom::error::Error<&[u8]>>::{closure#0}, nom::internal::MapRes<nom::bytes::complete::take_while_m_n<suricata::sdp::parser::parse_media_description::{closure#2}, &[u8], nom::error::Error<&[u8]>>::{closure#0}, core::str::converts::from_utf8>> as nom::internal::Parser<&[u8]>>::process::<nom::internal::OutputM<nom::internal::Emit, nom::internal::Check, nom::internal::Streaming>>
Line
Count
Source
88
93.1k
  fn process<OM: OutputMode>(&mut self, i: I) -> PResult<OM, I, Self::Output, Self::Error> {
89
93.1k
    let (i, _) = self
90
93.1k
      .f
91
93.1k
      .process::<OutputM<Check, OM::Error, OM::Incomplete>>(i)?;
92
5.54k
    let (i, o2) = self.g.process::<OM>(i)?;
93
94
5.01k
    Ok((i, o2))
95
93.1k
  }
<nom::sequence::Preceded<nom::character::complete::char<&[u8], nom::error::Error<&[u8]>>::{closure#0}, nom::internal::MapRes<nom::bytes::complete::take_till<suricata::sdp::parser::is_line_ending, &[u8], nom::error::Error<&[u8]>>::{closure#0}, core::str::converts::from_utf8>> as nom::internal::Parser<&[u8]>>::process::<nom::internal::OutputM<nom::internal::Emit, nom::internal::Check, nom::internal::Streaming>>
Line
Count
Source
88
1.13M
  fn process<OM: OutputMode>(&mut self, i: I) -> PResult<OM, I, Self::Output, Self::Error> {
89
1.13M
    let (i, _) = self
90
1.13M
      .f
91
1.13M
      .process::<OutputM<Check, OM::Error, OM::Incomplete>>(i)?;
92
192k
    let (i, o2) = self.g.process::<OM>(i)?;
93
94
191k
    Ok((i, o2))
95
1.13M
  }
<nom::sequence::Preceded<nom::character::complete::char<&[u8], nom::error::Error<&[u8]>>::{closure#0}, suricata::sdp::parser::parse_num> as nom::internal::Parser<&[u8]>>::process::<nom::internal::OutputM<nom::internal::Emit, nom::internal::Check, nom::internal::Streaming>>
Line
Count
Source
88
20.0k
  fn process<OM: OutputMode>(&mut self, i: I) -> PResult<OM, I, Self::Output, Self::Error> {
89
20.0k
    let (i, _) = self
90
20.0k
      .f
91
20.0k
      .process::<OutputM<Check, OM::Error, OM::Incomplete>>(i)?;
92
4.91k
    let (i, o2) = self.g.process::<OM>(i)?;
93
94
2.05k
    Ok((i, o2))
95
20.0k
  }
<nom::sequence::Preceded<nom::character::complete::char<&str, nom::error::Error<&str>>::{closure#0}, suricata::detect::requires::parse_next_version_part> as nom::internal::Parser<&str>>::process::<nom::internal::OutputM<nom::internal::Emit, nom::internal::Emit, nom::internal::Streaming>>
Line
Count
Source
88
63.0k
  fn process<OM: OutputMode>(&mut self, i: I) -> PResult<OM, I, Self::Output, Self::Error> {
89
63.0k
    let (i, _) = self
90
63.0k
      .f
91
63.0k
      .process::<OutputM<Check, OM::Error, OM::Incomplete>>(i)?;
92
62.3k
    let (i, o2) = self.g.process::<OM>(i)?;
93
94
61.0k
    Ok((i, o2))
95
63.0k
  }
<nom::sequence::Preceded<nom::bytes::streaming::take_while<suricata::sip::parser::hcolon::{closure#0}, &[u8], nom::error::Error<&[u8]>>::{closure#0}, nom::sequence::Terminated<nom::character::streaming::char<&[u8], nom::error::Error<&[u8]>>::{closure#0}, nom::bytes::streaming::take_while<suricata::sip::parser::hcolon::{closure#1}, &[u8], nom::error::Error<&[u8]>>::{closure#0}>> as nom::internal::Parser<&[u8]>>::process::<nom::internal::OutputM<nom::internal::Emit, nom::internal::Emit, nom::internal::Streaming>>
Line
Count
Source
88
905k
  fn process<OM: OutputMode>(&mut self, i: I) -> PResult<OM, I, Self::Output, Self::Error> {
89
905k
    let (i, _) = self
90
905k
      .f
91
905k
      .process::<OutputM<Check, OM::Error, OM::Incomplete>>(i)?;
92
905k
    let (i, o2) = self.g.process::<OM>(i)?;
93
94
902k
    Ok((i, o2))
95
905k
  }
Unexecuted instantiation: <nom::sequence::Preceded<nom::character::complete::multispace0<&str, nom::error::Error<&str>>, nom::combinator::Verify<nom::character::complete::not_line_ending<&str, nom::error::Error<&str>>, suricata::conf::get_memval::{closure#0}, str>> as nom::internal::Parser<&str>>::process::<nom::internal::OutputM<nom::internal::Emit, nom::internal::Emit, nom::internal::Streaming>>
Unexecuted instantiation: <nom::sequence::Preceded<nom::character::complete::multispace0<&str, nom::error::Error<&str>>, nom::number::complete::double<&str, nom::error::Error<&str>>> as nom::internal::Parser<&str>>::process::<nom::internal::OutputM<nom::internal::Emit, nom::internal::Emit, nom::internal::Streaming>>
<nom::sequence::Preceded<nom::character::complete::multispace1<&str, nom::error::Error<&str>>, nom::combinator::Verify<suricata::asn1::parse_rules::parse_i32_number, suricata::asn1::parse_rules::asn1_parse_rule::relative_offset::{closure#0}, i32>> as nom::internal::Parser<&str>>::process::<nom::internal::OutputM<nom::internal::Emit, nom::internal::Emit, nom::internal::Streaming>>
Line
Count
Source
88
531
  fn process<OM: OutputMode>(&mut self, i: I) -> PResult<OM, I, Self::Output, Self::Error> {
89
531
    let (i, _) = self
90
531
      .f
91
531
      .process::<OutputM<Check, OM::Error, OM::Incomplete>>(i)?;
92
509
    let (i, o2) = self.g.process::<OM>(i)?;
93
94
490
    Ok((i, o2))
95
531
  }
<nom::sequence::Preceded<nom::character::complete::multispace1<&str, nom::error::Error<&str>>, suricata::asn1::parse_rules::parse_u16_number> as nom::internal::Parser<&str>>::process::<nom::internal::OutputM<nom::internal::Emit, nom::internal::Emit, nom::internal::Streaming>>
Line
Count
Source
88
810
  fn process<OM: OutputMode>(&mut self, i: I) -> PResult<OM, I, Self::Output, Self::Error> {
89
810
    let (i, _) = self
90
810
      .f
91
810
      .process::<OutputM<Check, OM::Error, OM::Incomplete>>(i)?;
92
798
    let (i, o2) = self.g.process::<OM>(i)?;
93
94
788
    Ok((i, o2))
95
810
  }
<nom::sequence::Preceded<nom::character::complete::multispace1<&str, nom::error::Error<&str>>, suricata::asn1::parse_rules::parse_u32_number> as nom::internal::Parser<&str>>::process::<nom::internal::OutputM<nom::internal::Emit, nom::internal::Emit, nom::internal::Streaming>>
Line
Count
Source
88
386
  fn process<OM: OutputMode>(&mut self, i: I) -> PResult<OM, I, Self::Output, Self::Error> {
89
386
    let (i, _) = self
90
386
      .f
91
386
      .process::<OutputM<Check, OM::Error, OM::Incomplete>>(i)?;
92
342
    let (i, o2) = self.g.process::<OM>(i)?;
93
94
327
    Ok((i, o2))
95
386
  }
Unexecuted instantiation: <nom::sequence::Preceded<_, _> as nom::internal::Parser<_>>::process::<_>
96
}
97
98
/// Gets an object from the first parser,
99
/// then matches an object from the second parser and discards it.
100
///
101
/// # Arguments
102
/// * `first` The first parser to apply.
103
/// * `second` The second parser to match an object.
104
///
105
/// ```rust
106
/// # use nom::{Err, error::ErrorKind, Needed, Parser};
107
/// # use nom::Needed::Size;
108
/// use nom::sequence::terminated;
109
/// use nom::bytes::complete::tag;
110
///
111
/// let mut parser = terminated(tag("abc"), tag("efg"));
112
///
113
/// assert_eq!(parser.parse("abcefg"), Ok(("", "abc")));
114
/// assert_eq!(parser.parse("abcefghij"), Ok(("hij", "abc")));
115
/// assert_eq!(parser.parse(""), Err(Err::Error(("", ErrorKind::Tag))));
116
/// assert_eq!(parser.parse("123"), Err(Err::Error(("123", ErrorKind::Tag))));
117
/// ```
118
1.43M
pub fn terminated<I, O, E: ParseError<I>, F, G>(
119
1.43M
  first: F,
120
1.43M
  second: G,
121
1.43M
) -> impl Parser<I, Output = O, Error = E>
122
1.43M
where
123
1.43M
  F: Parser<I, Output = O, Error = E>,
124
1.43M
  G: Parser<I, Error = E>,
125
{
126
1.43M
  Terminated {
127
1.43M
    f: first,
128
1.43M
    g: second,
129
1.43M
  }
130
1.43M
}
nom::sequence::terminated::<&[u8], &[u8], nom::error::Error<&[u8]>, nom::character::complete::digit1<&[u8], nom::error::Error<&[u8]>>, nom::character::complete::multispace0<&[u8], nom::error::Error<&[u8]>>>
Line
Count
Source
118
378k
pub fn terminated<I, O, E: ParseError<I>, F, G>(
119
378k
  first: F,
120
378k
  second: G,
121
378k
) -> impl Parser<I, Output = O, Error = E>
122
378k
where
123
378k
  F: Parser<I, Output = O, Error = E>,
124
378k
  G: Parser<I, Error = E>,
125
{
126
378k
  Terminated {
127
378k
    f: first,
128
378k
    g: second,
129
378k
  }
130
378k
}
nom::sequence::terminated::<&[u8], &[u8], suricata::pgsql::parser::PgsqlParseError<&[u8]>, nom::bytes::streaming::take<u32, &[u8], suricata::pgsql::parser::PgsqlParseError<&[u8]>>::{closure#0}, nom::combinator::eof<&[u8], suricata::pgsql::parser::PgsqlParseError<&[u8]>>>
Line
Count
Source
118
1.07k
pub fn terminated<I, O, E: ParseError<I>, F, G>(
119
1.07k
  first: F,
120
1.07k
  second: G,
121
1.07k
) -> impl Parser<I, Output = O, Error = E>
122
1.07k
where
123
1.07k
  F: Parser<I, Output = O, Error = E>,
124
1.07k
  G: Parser<I, Error = E>,
125
{
126
1.07k
  Terminated {
127
1.07k
    f: first,
128
1.07k
    g: second,
129
1.07k
  }
130
1.07k
}
nom::sequence::terminated::<&[u8], &[u8], (), nom::bytes::streaming::tag<&str, &[u8], ()>::{closure#0}, nom::bytes::streaming::tag<&[u8], &[u8], ()>::{closure#0}>
Line
Count
Source
118
89.4k
pub fn terminated<I, O, E: ParseError<I>, F, G>(
119
89.4k
  first: F,
120
89.4k
  second: G,
121
89.4k
) -> impl Parser<I, Output = O, Error = E>
122
89.4k
where
123
89.4k
  F: Parser<I, Output = O, Error = E>,
124
89.4k
  G: Parser<I, Error = E>,
125
{
126
89.4k
  Terminated {
127
89.4k
    f: first,
128
89.4k
    g: second,
129
89.4k
  }
130
89.4k
}
nom::sequence::terminated::<&[u8], alloc::vec::Vec<suricata::pgsql::parser::PgsqlParameter>, suricata::pgsql::parser::PgsqlParseError<&[u8]>, nom::multi::Many1<suricata::pgsql::parser::pgsql_parse_generic_parameter>, nom::bytes::streaming::tag<&[u8], &[u8], suricata::pgsql::parser::PgsqlParseError<&[u8]>>::{closure#0}>
Line
Count
Source
118
16.8k
pub fn terminated<I, O, E: ParseError<I>, F, G>(
119
16.8k
  first: F,
120
16.8k
  second: G,
121
16.8k
) -> impl Parser<I, Output = O, Error = E>
122
16.8k
where
123
16.8k
  F: Parser<I, Output = O, Error = E>,
124
16.8k
  G: Parser<I, Error = E>,
125
{
126
16.8k
  Terminated {
127
16.8k
    f: first,
128
16.8k
    g: second,
129
16.8k
  }
130
16.8k
}
nom::sequence::terminated::<&[u8], alloc::vec::Vec<suricata::pgsql::parser::SASLAuthenticationMechanism>, suricata::pgsql::parser::PgsqlParseError<&[u8]>, nom::multi::Many1<suricata::pgsql::parser::parse_sasl_mechanism>, nom::bytes::streaming::tag<&[u8], &[u8], suricata::pgsql::parser::PgsqlParseError<&[u8]>>::{closure#0}>
Line
Count
Source
118
2.79k
pub fn terminated<I, O, E: ParseError<I>, F, G>(
119
2.79k
  first: F,
120
2.79k
  second: G,
121
2.79k
) -> impl Parser<I, Output = O, Error = E>
122
2.79k
where
123
2.79k
  F: Parser<I, Output = O, Error = E>,
124
2.79k
  G: Parser<I, Error = E>,
125
{
126
2.79k
  Terminated {
127
2.79k
    f: first,
128
2.79k
    g: second,
129
2.79k
  }
130
2.79k
}
nom::sequence::terminated::<&[u8], char, nom::error::Error<&[u8]>, nom::character::streaming::char<&[u8], nom::error::Error<&[u8]>>::{closure#0}, nom::bytes::streaming::take_while<suricata::sip::parser::hcolon::{closure#1}, &[u8], nom::error::Error<&[u8]>>::{closure#0}>
Line
Count
Source
118
905k
pub fn terminated<I, O, E: ParseError<I>, F, G>(
119
905k
  first: F,
120
905k
  second: G,
121
905k
) -> impl Parser<I, Output = O, Error = E>
122
905k
where
123
905k
  F: Parser<I, Output = O, Error = E>,
124
905k
  G: Parser<I, Error = E>,
125
{
126
905k
  Terminated {
127
905k
    f: first,
128
905k
    g: second,
129
905k
  }
130
905k
}
nom::sequence::terminated::<&[u8], &[u8], nom::error::Error<&[u8]>, nom::bytes::complete::take_while1<suricata::applayertemplate::template::probe::{closure#0}, &[u8], nom::error::Error<&[u8]>>::{closure#0}, nom::bytes::complete::tag<&str, &[u8], nom::error::Error<&[u8]>>::{closure#0}>
Line
Count
Source
118
9.90k
pub fn terminated<I, O, E: ParseError<I>, F, G>(
119
9.90k
  first: F,
120
9.90k
  second: G,
121
9.90k
) -> impl Parser<I, Output = O, Error = E>
122
9.90k
where
123
9.90k
  F: Parser<I, Output = O, Error = E>,
124
9.90k
  G: Parser<I, Error = E>,
125
{
126
9.90k
  Terminated {
127
9.90k
    f: first,
128
9.90k
    g: second,
129
9.90k
  }
130
9.90k
}
nom::sequence::terminated::<&[u8], &[u8], nom::error::Error<&[u8]>, nom::bytes::streaming::take_while<suricata::ssh::parser::is_not_lineend, &[u8], nom::error::Error<&[u8]>>::{closure#0}, nom::branch::Choice<(nom::bytes::streaming::tag<&str, &[u8], nom::error::Error<&[u8]>>::{closure#0}, nom::bytes::streaming::tag<&str, &[u8], nom::error::Error<&[u8]>>::{closure#0}, suricata::ssh::parser::ssh_parse_line::parser)>>
Line
Count
Source
118
33.9k
pub fn terminated<I, O, E: ParseError<I>, F, G>(
119
33.9k
  first: F,
120
33.9k
  second: G,
121
33.9k
) -> impl Parser<I, Output = O, Error = E>
122
33.9k
where
123
33.9k
  F: Parser<I, Output = O, Error = E>,
124
33.9k
  G: Parser<I, Error = E>,
125
{
126
33.9k
  Terminated {
127
33.9k
    f: first,
128
33.9k
    g: second,
129
33.9k
  }
130
33.9k
}
Unexecuted instantiation: nom::sequence::terminated::<_, _, _, _, _>
131
132
/// a
133
pub struct Terminated<F, G> {
134
  f: F,
135
  g: G,
136
}
137
138
impl<I, E: ParseError<I>, F: Parser<I, Error = E>, G: Parser<I, Error = E>> Parser<I>
139
  for Terminated<F, G>
140
{
141
  type Output = <F as Parser<I>>::Output;
142
  type Error = E;
143
144
  #[inline(always)]
145
1.43M
  fn process<OM: OutputMode>(&mut self, i: I) -> PResult<OM, I, Self::Output, Self::Error> {
146
1.43M
    let (i, o1) = self.f.process::<OM>(i)?;
147
1.31M
    let (i, _) = self
148
1.31M
      .g
149
1.31M
      .process::<OutputM<Check, OM::Error, OM::Incomplete>>(i)?;
150
151
1.30M
    Ok((i, o1))
152
1.43M
  }
<nom::sequence::Terminated<nom::character::complete::digit1<&[u8], nom::error::Error<&[u8]>>, nom::character::complete::multispace0<&[u8], nom::error::Error<&[u8]>>> as nom::internal::Parser<&[u8]>>::process::<nom::internal::OutputM<nom::internal::Emit, nom::internal::Emit, nom::internal::Streaming>>
Line
Count
Source
145
378k
  fn process<OM: OutputMode>(&mut self, i: I) -> PResult<OM, I, Self::Output, Self::Error> {
146
378k
    let (i, o1) = self.f.process::<OM>(i)?;
147
368k
    let (i, _) = self
148
368k
      .g
149
368k
      .process::<OutputM<Check, OM::Error, OM::Incomplete>>(i)?;
150
151
368k
    Ok((i, o1))
152
378k
  }
<nom::sequence::Terminated<nom::multi::Many1<suricata::pgsql::parser::parse_sasl_mechanism>, nom::bytes::streaming::tag<&[u8], &[u8], suricata::pgsql::parser::PgsqlParseError<&[u8]>>::{closure#0}> as nom::internal::Parser<&[u8]>>::process::<nom::internal::OutputM<nom::internal::Emit, nom::internal::Emit, nom::internal::Streaming>>
Line
Count
Source
145
2.79k
  fn process<OM: OutputMode>(&mut self, i: I) -> PResult<OM, I, Self::Output, Self::Error> {
146
2.79k
    let (i, o1) = self.f.process::<OM>(i)?;
147
1.84k
    let (i, _) = self
148
1.84k
      .g
149
1.84k
      .process::<OutputM<Check, OM::Error, OM::Incomplete>>(i)?;
150
151
1.23k
    Ok((i, o1))
152
2.79k
  }
<nom::sequence::Terminated<nom::multi::Many1<suricata::pgsql::parser::pgsql_parse_generic_parameter>, nom::bytes::streaming::tag<&[u8], &[u8], suricata::pgsql::parser::PgsqlParseError<&[u8]>>::{closure#0}> as nom::internal::Parser<&[u8]>>::process::<nom::internal::OutputM<nom::internal::Emit, nom::internal::Check, nom::internal::Streaming>>
Line
Count
Source
145
16.8k
  fn process<OM: OutputMode>(&mut self, i: I) -> PResult<OM, I, Self::Output, Self::Error> {
146
16.8k
    let (i, o1) = self.f.process::<OM>(i)?;
147
7.35k
    let (i, _) = self
148
7.35k
      .g
149
7.35k
      .process::<OutputM<Check, OM::Error, OM::Incomplete>>(i)?;
150
151
7.35k
    Ok((i, o1))
152
16.8k
  }
<nom::sequence::Terminated<nom::bytes::streaming::tag<&str, &[u8], ()>::{closure#0}, nom::bytes::streaming::tag<&[u8], &[u8], ()>::{closure#0}> as nom::internal::Parser<&[u8]>>::process::<nom::internal::OutputM<nom::internal::Emit, nom::internal::Emit, nom::internal::Streaming>>
Line
Count
Source
145
89.4k
  fn process<OM: OutputMode>(&mut self, i: I) -> PResult<OM, I, Self::Output, Self::Error> {
146
89.4k
    let (i, o1) = self.f.process::<OM>(i)?;
147
5.20k
    let (i, _) = self
148
5.20k
      .g
149
5.20k
      .process::<OutputM<Check, OM::Error, OM::Incomplete>>(i)?;
150
151
4.80k
    Ok((i, o1))
152
89.4k
  }
<nom::sequence::Terminated<nom::bytes::streaming::take<u32, &[u8], suricata::pgsql::parser::PgsqlParseError<&[u8]>>::{closure#0}, nom::combinator::eof<&[u8], suricata::pgsql::parser::PgsqlParseError<&[u8]>>> as nom::internal::Parser<&[u8]>>::process::<nom::internal::OutputM<nom::internal::Emit, nom::internal::Emit, nom::internal::Streaming>>
Line
Count
Source
145
1.07k
  fn process<OM: OutputMode>(&mut self, i: I) -> PResult<OM, I, Self::Output, Self::Error> {
146
1.07k
    let (i, o1) = self.f.process::<OM>(i)?;
147
716
    let (i, _) = self
148
716
      .g
149
716
      .process::<OutputM<Check, OM::Error, OM::Incomplete>>(i)?;
150
151
359
    Ok((i, o1))
152
1.07k
  }
<nom::sequence::Terminated<nom::character::streaming::char<&[u8], nom::error::Error<&[u8]>>::{closure#0}, nom::bytes::streaming::take_while<suricata::sip::parser::hcolon::{closure#1}, &[u8], nom::error::Error<&[u8]>>::{closure#0}> as nom::internal::Parser<&[u8]>>::process::<nom::internal::OutputM<nom::internal::Emit, nom::internal::Emit, nom::internal::Streaming>>
Line
Count
Source
145
905k
  fn process<OM: OutputMode>(&mut self, i: I) -> PResult<OM, I, Self::Output, Self::Error> {
146
905k
    let (i, o1) = self.f.process::<OM>(i)?;
147
903k
    let (i, _) = self
148
903k
      .g
149
903k
      .process::<OutputM<Check, OM::Error, OM::Incomplete>>(i)?;
150
151
902k
    Ok((i, o1))
152
905k
  }
<nom::sequence::Terminated<nom::bytes::complete::take_while1<suricata::applayertemplate::template::probe::{closure#0}, &[u8], nom::error::Error<&[u8]>>::{closure#0}, nom::bytes::complete::tag<&str, &[u8], nom::error::Error<&[u8]>>::{closure#0}> as nom::internal::Parser<&[u8]>>::process::<nom::internal::OutputM<nom::internal::Emit, nom::internal::Emit, nom::internal::Streaming>>
Line
Count
Source
145
9.90k
  fn process<OM: OutputMode>(&mut self, i: I) -> PResult<OM, I, Self::Output, Self::Error> {
146
9.90k
    let (i, o1) = self.f.process::<OM>(i)?;
147
6.40k
    let (i, _) = self
148
6.40k
      .g
149
6.40k
      .process::<OutputM<Check, OM::Error, OM::Incomplete>>(i)?;
150
151
6.24k
    Ok((i, o1))
152
9.90k
  }
<nom::sequence::Terminated<nom::bytes::streaming::take_while<suricata::ssh::parser::is_not_lineend, &[u8], nom::error::Error<&[u8]>>::{closure#0}, nom::branch::Choice<(nom::bytes::streaming::tag<&str, &[u8], nom::error::Error<&[u8]>>::{closure#0}, nom::bytes::streaming::tag<&str, &[u8], nom::error::Error<&[u8]>>::{closure#0}, suricata::ssh::parser::ssh_parse_line::parser)>> as nom::internal::Parser<&[u8]>>::process::<nom::internal::OutputM<nom::internal::Emit, nom::internal::Emit, nom::internal::Streaming>>
Line
Count
Source
145
33.9k
  fn process<OM: OutputMode>(&mut self, i: I) -> PResult<OM, I, Self::Output, Self::Error> {
146
33.9k
    let (i, o1) = self.f.process::<OM>(i)?;
147
20.7k
    let (i, _) = self
148
20.7k
      .g
149
20.7k
      .process::<OutputM<Check, OM::Error, OM::Incomplete>>(i)?;
150
151
16.9k
    Ok((i, o1))
152
33.9k
  }
Unexecuted instantiation: <nom::sequence::Terminated<_, _> as nom::internal::Parser<_>>::process::<_>
153
}
154
155
/// Gets an object from the first parser,
156
/// then matches an object from the sep_parser and discards it,
157
/// then gets another object from the second parser.
158
///
159
/// # Arguments
160
/// * `first` The first parser to apply.
161
/// * `sep` The separator parser to apply.
162
/// * `second` The second parser to apply.
163
///
164
/// ```rust
165
/// # use nom::{Err, error::ErrorKind, Needed, Parser};
166
/// # use nom::Needed::Size;
167
/// use nom::sequence::separated_pair;
168
/// use nom::bytes::complete::tag;
169
///
170
/// let mut parser = separated_pair(tag("abc"), tag("|"), tag("efg"));
171
///
172
/// assert_eq!(parser.parse("abc|efg"), Ok(("", ("abc", "efg"))));
173
/// assert_eq!(parser.parse("abc|efghij"), Ok(("hij", ("abc", "efg"))));
174
/// assert_eq!(parser.parse(""), Err(Err::Error(("", ErrorKind::Tag))));
175
/// assert_eq!(parser.parse("123"), Err(Err::Error(("123", ErrorKind::Tag))));
176
/// ```
177
9.39k
pub fn separated_pair<I, O1, O2, E: ParseError<I>, F, G, H>(
178
9.39k
  first: F,
179
9.39k
  sep: G,
180
9.39k
  second: H,
181
9.39k
) -> impl Parser<I, Output = (O1, O2), Error = E>
182
9.39k
where
183
9.39k
  F: Parser<I, Output = O1, Error = E>,
184
9.39k
  G: Parser<I, Error = E>,
185
9.39k
  H: Parser<I, Output = O2, Error = E>,
186
{
187
9.39k
  first.and(preceded(sep, second))
188
9.39k
}
nom::sequence::separated_pair::<&str, &str, i32, nom::error::Error<&str>, nom::bytes::complete::tag<&str, &str, nom::error::Error<&str>>::{closure#0}, nom::character::complete::multispace1<&str, nom::error::Error<&str>>, nom::combinator::Verify<suricata::asn1::parse_rules::parse_i32_number, suricata::asn1::parse_rules::asn1_parse_rule::relative_offset::{closure#0}, i32>>
Line
Count
Source
177
3.13k
pub fn separated_pair<I, O1, O2, E: ParseError<I>, F, G, H>(
178
3.13k
  first: F,
179
3.13k
  sep: G,
180
3.13k
  second: H,
181
3.13k
) -> impl Parser<I, Output = (O1, O2), Error = E>
182
3.13k
where
183
3.13k
  F: Parser<I, Output = O1, Error = E>,
184
3.13k
  G: Parser<I, Error = E>,
185
3.13k
  H: Parser<I, Output = O2, Error = E>,
186
{
187
3.13k
  first.and(preceded(sep, second))
188
3.13k
}
nom::sequence::separated_pair::<&str, &str, u32, nom::error::Error<&str>, nom::bytes::complete::tag<&str, &str, nom::error::Error<&str>>::{closure#0}, nom::character::complete::multispace1<&str, nom::error::Error<&str>>, suricata::asn1::parse_rules::parse_u32_number>
Line
Count
Source
177
3.13k
pub fn separated_pair<I, O1, O2, E: ParseError<I>, F, G, H>(
178
3.13k
  first: F,
179
3.13k
  sep: G,
180
3.13k
  second: H,
181
3.13k
) -> impl Parser<I, Output = (O1, O2), Error = E>
182
3.13k
where
183
3.13k
  F: Parser<I, Output = O1, Error = E>,
184
3.13k
  G: Parser<I, Error = E>,
185
3.13k
  H: Parser<I, Output = O2, Error = E>,
186
{
187
3.13k
  first.and(preceded(sep, second))
188
3.13k
}
nom::sequence::separated_pair::<&str, &str, u16, nom::error::Error<&str>, nom::bytes::complete::tag<&str, &str, nom::error::Error<&str>>::{closure#0}, nom::character::complete::multispace1<&str, nom::error::Error<&str>>, suricata::asn1::parse_rules::parse_u16_number>
Line
Count
Source
177
3.13k
pub fn separated_pair<I, O1, O2, E: ParseError<I>, F, G, H>(
178
3.13k
  first: F,
179
3.13k
  sep: G,
180
3.13k
  second: H,
181
3.13k
) -> impl Parser<I, Output = (O1, O2), Error = E>
182
3.13k
where
183
3.13k
  F: Parser<I, Output = O1, Error = E>,
184
3.13k
  G: Parser<I, Error = E>,
185
3.13k
  H: Parser<I, Output = O2, Error = E>,
186
{
187
3.13k
  first.and(preceded(sep, second))
188
3.13k
}
Unexecuted instantiation: nom::sequence::separated_pair::<_, _, _, _, _, _, _>
189
190
/// Matches an object from the first parser and discards it,
191
/// then gets an object from the second parser,
192
/// and finally matches an object from the third parser and discards it.
193
///
194
/// # Arguments
195
/// * `first` The first parser to apply and discard.
196
/// * `second` The second parser to apply.
197
/// * `third` The third parser to apply and discard.
198
///
199
/// ```rust
200
/// # use nom::{Err, error::ErrorKind, Needed, Parser};
201
/// # use nom::Needed::Size;
202
/// use nom::sequence::delimited;
203
/// use nom::bytes::complete::tag;
204
///
205
/// let mut parser = delimited(tag("("), tag("abc"), tag(")"));
206
///
207
/// assert_eq!(parser.parse("(abc)"), Ok(("", "abc")));
208
/// assert_eq!(parser.parse("(abc)def"), Ok(("def", "abc")));
209
/// assert_eq!(parser.parse(""), Err(Err::Error(("", ErrorKind::Tag))));
210
/// assert_eq!(parser.parse("123"), Err(Err::Error(("123", ErrorKind::Tag))));
211
/// ```
212
1.28M
pub fn delimited<I, O, E: ParseError<I>, F, G, H>(
213
1.28M
  first: F,
214
1.28M
  second: G,
215
1.28M
  third: H,
216
1.28M
) -> impl Parser<I, Output = O, Error = E>
217
1.28M
where
218
1.28M
  F: Parser<I, Error = E>,
219
1.28M
  G: Parser<I, Output = O, Error = E>,
220
1.28M
  H: Parser<I, Error = E>,
221
{
222
1.28M
  preceded(first, terminated(second, third))
223
1.28M
}
nom::sequence::delimited::<&[u8], &[u8], nom::error::Error<&[u8]>, nom::character::complete::multispace0<&[u8], nom::error::Error<&[u8]>>, nom::character::complete::digit1<&[u8], nom::error::Error<&[u8]>>, nom::character::complete::multispace0<&[u8], nom::error::Error<&[u8]>>>
Line
Count
Source
212
378k
pub fn delimited<I, O, E: ParseError<I>, F, G, H>(
213
378k
  first: F,
214
378k
  second: G,
215
378k
  third: H,
216
378k
) -> impl Parser<I, Output = O, Error = E>
217
378k
where
218
378k
  F: Parser<I, Error = E>,
219
378k
  G: Parser<I, Output = O, Error = E>,
220
378k
  H: Parser<I, Error = E>,
221
{
222
378k
  preceded(first, terminated(second, third))
223
378k
}
nom::sequence::delimited::<&[u8], char, nom::error::Error<&[u8]>, nom::bytes::streaming::take_while<suricata::sip::parser::hcolon::{closure#0}, &[u8], nom::error::Error<&[u8]>>::{closure#0}, nom::character::streaming::char<&[u8], nom::error::Error<&[u8]>>::{closure#0}, nom::bytes::streaming::take_while<suricata::sip::parser::hcolon::{closure#1}, &[u8], nom::error::Error<&[u8]>>::{closure#0}>
Line
Count
Source
212
905k
pub fn delimited<I, O, E: ParseError<I>, F, G, H>(
213
905k
  first: F,
214
905k
  second: G,
215
905k
  third: H,
216
905k
) -> impl Parser<I, Output = O, Error = E>
217
905k
where
218
905k
  F: Parser<I, Error = E>,
219
905k
  G: Parser<I, Output = O, Error = E>,
220
905k
  H: Parser<I, Error = E>,
221
{
222
905k
  preceded(first, terminated(second, third))
223
905k
}
Unexecuted instantiation: nom::sequence::delimited::<_, _, _, _, _, _>
224
225
/// Helper trait for the tuple combinator.
226
///
227
/// This trait is implemented for tuples of parsers of up to 21 elements.
228
#[deprecated(since = "8.0.0", note = "`Parser` is directly implemented for tuples")]
229
#[allow(deprecated)]
230
pub trait Tuple<I, O, E> {
231
  /// Parses the input and returns a tuple of results of each parser.
232
  fn parse_tuple(&mut self, input: I) -> IResult<I, O, E>;
233
}
234
235
#[allow(deprecated)]
236
impl<Input, Output, Error: ParseError<Input>, F: Parser<Input, Output = Output, Error = Error>>
237
  Tuple<Input, (Output,), Error> for (F,)
238
{
239
0
  fn parse_tuple(&mut self, input: Input) -> IResult<Input, (Output,), Error> {
240
0
    self.0.parse(input).map(|(i, o)| (i, (o,)))
241
0
  }
242
}
243
244
macro_rules! tuple_trait(
245
  ($name1:ident $ty1:ident, $name2: ident $ty2:ident, $($name:ident $ty:ident),*) => (
246
    tuple_trait!(__impl $name1 $ty1, $name2 $ty2; $($name $ty),*);
247
  );
248
  (__impl $($name:ident $ty: ident),+; $name1:ident $ty1:ident, $($name2:ident $ty2:ident),*) => (
249
    tuple_trait_impl!($($name $ty),+);
250
    tuple_trait!(__impl $($name $ty),+ , $name1 $ty1; $($name2 $ty2),*);
251
  );
252
  (__impl $($name:ident $ty: ident),+; $name1:ident $ty1:ident) => (
253
    tuple_trait_impl!($($name $ty),+);
254
    tuple_trait_impl!($($name $ty),+, $name1 $ty1);
255
  );
256
);
257
258
macro_rules! tuple_trait_impl(
259
  ($($name:ident $ty: ident),+) => (
260
    #[allow(deprecated)]
261
    impl<
262
      Input: Clone, $($ty),+ , Error: ParseError<Input>,
263
      $($name: Parser<Input, Output = $ty, Error = Error>),+
264
    > Tuple<Input, ( $($ty),+ ), Error> for ( $($name),+ ) {
265
0
      fn parse_tuple(&mut self, input: Input) -> IResult<Input, ( $($ty),+ ), Error> {
266
0
        tuple_trait_inner!(0, self, input, (), $($name)+)
267
268
0
      }
Unexecuted instantiation: <(_, _) as nom::sequence::Tuple<_, (_, _), _>>::parse_tuple
Unexecuted instantiation: <(_, _, _) as nom::sequence::Tuple<_, (_, _, _), _>>::parse_tuple
Unexecuted instantiation: <(_, _, _, _) as nom::sequence::Tuple<_, (_, _, _, _), _>>::parse_tuple
Unexecuted instantiation: <(_, _, _, _, _) as nom::sequence::Tuple<_, (_, _, _, _, _), _>>::parse_tuple
Unexecuted instantiation: <(_, _, _, _, _, _) as nom::sequence::Tuple<_, (_, _, _, _, _, _), _>>::parse_tuple
Unexecuted instantiation: <(_, _, _, _, _, _, _) as nom::sequence::Tuple<_, (_, _, _, _, _, _, _), _>>::parse_tuple
Unexecuted instantiation: <(_, _, _, _, _, _, _, _) as nom::sequence::Tuple<_, (_, _, _, _, _, _, _, _), _>>::parse_tuple
Unexecuted instantiation: <(_, _, _, _, _, _, _, _, _) as nom::sequence::Tuple<_, (_, _, _, _, _, _, _, _, _), _>>::parse_tuple
Unexecuted instantiation: <(_, _, _, _, _, _, _, _, _, _) as nom::sequence::Tuple<_, (_, _, _, _, _, _, _, _, _, _), _>>::parse_tuple
Unexecuted instantiation: <(_, _, _, _, _, _, _, _, _, _, _) as nom::sequence::Tuple<_, (_, _, _, _, _, _, _, _, _, _, _), _>>::parse_tuple
Unexecuted instantiation: <(_, _, _, _, _, _, _, _, _, _, _, _) as nom::sequence::Tuple<_, (_, _, _, _, _, _, _, _, _, _, _, _), _>>::parse_tuple
Unexecuted instantiation: <(_, _, _, _, _, _, _, _, _, _, _, _, _) as nom::sequence::Tuple<_, (_, _, _, _, _, _, _, _, _, _, _, _, _), _>>::parse_tuple
Unexecuted instantiation: <(_, _, _, _, _, _, _, _, _, _, _, _, _, _) as nom::sequence::Tuple<_, (_, _, _, _, _, _, _, _, _, _, _, _, _, _), _>>::parse_tuple
Unexecuted instantiation: <(_, _, _, _, _, _, _, _, _, _, _, _, _, _, _) as nom::sequence::Tuple<_, (_, _, _, _, _, _, _, _, _, _, _, _, _, _, _), _>>::parse_tuple
Unexecuted instantiation: <(_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _) as nom::sequence::Tuple<_, (_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _), _>>::parse_tuple
Unexecuted instantiation: <(_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _) as nom::sequence::Tuple<_, (_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _), _>>::parse_tuple
Unexecuted instantiation: <(_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _) as nom::sequence::Tuple<_, (_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _), _>>::parse_tuple
Unexecuted instantiation: <(_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _) as nom::sequence::Tuple<_, (_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _), _>>::parse_tuple
Unexecuted instantiation: <(_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _) as nom::sequence::Tuple<_, (_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _), _>>::parse_tuple
Unexecuted instantiation: <(_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _) as nom::sequence::Tuple<_, (_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _), _>>::parse_tuple
269
    }
270
  );
271
);
272
273
macro_rules! tuple_trait_inner(
274
  ($it:tt, $self:expr, $input:expr, (), $head:ident $($id:ident)+) => ({
275
    let (i, o) = $self.$it.parse($input)?;
276
277
    succ!($it, tuple_trait_inner!($self, i, ( o ), $($id)+))
278
  });
279
  ($it:tt, $self:expr, $input:expr, ($($parsed:tt)*), $head:ident $($id:ident)+) => ({
280
    let (i, o) = $self.$it.parse($input)?;
281
282
    succ!($it, tuple_trait_inner!($self, i, ($($parsed)* , o), $($id)+))
283
  });
284
  ($it:tt, $self:expr, $input:expr, ($($parsed:tt)*), $head:ident) => ({
285
    let (i, o) = $self.$it.parse($input)?;
286
287
    Ok((i, ($($parsed)* , o)))
288
  });
289
);
290
291
tuple_trait!(FnA A, FnB B, FnC C, FnD D, FnE E, FnF F, FnG G, FnH H, FnI I, FnJ J, FnK K, FnL L,
292
  FnM M, FnN N, FnO O, FnP P, FnQ Q, FnR R, FnS S, FnT T, FnU U);
293
294
// Special case: implement `Tuple` for `()`, the unit type.
295
// This can come up in macros which accept a variable number of arguments.
296
// Literally, `()` is an empty tuple, so it should simply parse nothing.
297
#[allow(deprecated)]
298
impl<I, E: ParseError<I>> Tuple<I, (), E> for () {
299
0
  fn parse_tuple(&mut self, input: I) -> IResult<I, (), E> {
300
0
    Ok((input, ()))
301
0
  }
302
}
303
304
///Applies a tuple of parsers one by one and returns their results as a tuple.
305
///There is a maximum of 21 parsers
306
/// ```rust
307
/// # use nom::{Err, error::ErrorKind};
308
/// use nom::sequence::tuple;
309
/// use nom::character::complete::{alpha1, digit1};
310
/// let mut parser = tuple((alpha1, digit1, alpha1));
311
///
312
/// assert_eq!(parser("abc123def"), Ok(("", ("abc", "123", "def"))));
313
/// assert_eq!(parser("123def"), Err(Err::Error(("123def", ErrorKind::Alpha))));
314
/// ```
315
#[deprecated(since = "8.0.0", note = "`Parser` is directly implemented for tuples")]
316
#[allow(deprecated)]
317
0
pub fn tuple<I, O, E: ParseError<I>, List: Tuple<I, O, E>>(
318
0
  mut l: List,
319
0
) -> impl FnMut(I) -> IResult<I, O, E> {
320
0
  move |i: I| l.parse_tuple(i)
321
0
}