Lines Matching defs:Err
14 /// was not parsed) and the produced value. The `Err` side contains an instance of `nom::Err`.
18 pub type IResult<I, O, E = error::Error<I>> = Result<(I, O), Err<E>>;
23 /// management libraries. It keeps the same `Ok` branch, and merges `Err::Error`
24 /// and `Err::Failure` into the `Err` side.
26 /// *warning*: if the result is `Err(Err::Incomplete(_))`, this method will panic.
30 /// Once the parser returns either `Ok(_)`, `Err(Err::Error(_))` or `Err(Err::Failure(_))`,
39 Err(Err::Error(e)) | Err(Err::Failure(e)) => Err(e),
40 Err(Err::Incomplete(_)) => {
41 panic!("Cannot call `finish()` on `Err(Err::Incomplete(_))`: this result means that the parser does not have enough data to decide, you should gather more data and try to reapply the parser instead")
81 /// The `Err` enum indicates the parser was not successful
97 pub enum Err<E> {
108 impl<E> Err<E> {
111 if let Err::Incomplete(_) = self {
119 pub fn map<E2, F>(self, f: F) -> Err<E2>
124 Err::Incomplete(n) => Err::Incomplete(n),
125 Err::Failure(t) => Err::Failure(f(t)),
126 Err::Error(t) => Err::Error(f(t)),
131 pub fn convert<F>(e: Err<F>) -> Self
139 impl<T> Err<(T, ErrorKind)> {
140 /// Maps `Err<(T, ErrorKind)>` to `Err<(U, ErrorKind)>` with the given `F: T -> U`
141 pub fn map_input<U, F>(self, f: F) -> Err<(U, ErrorKind)>
146 Err::Incomplete(n) => Err::Incomplete(n),
147 Err::Failure((input, k)) => Err::Failure((f(input), k)),
148 Err::Error((input, k)) => Err::Error((f(input), k)),
153 impl<T> Err<error::Error<T>> {
154 /// Maps `Err<error::Error<T>>` to `Err<error::Error<U>>` with the given `F: T -> U`
155 pub fn map_input<U, F>(self, f: F) -> Err<error::Error<U>>
160 Err::Incomplete(n) => Err::Incomplete(n),
161 Err::Failure(error::Error { input, code }) => Err::Failure(error::Error {
165 Err::Error(error::Error { input, code }) => Err::Error(error::Error {
176 impl Err<(&[u8], ErrorKind)> {
179 pub fn to_owned(self) -> Err<(Vec<u8>, ErrorKind)> {
185 impl Err<(&str, ErrorKind)> {
188 pub fn to_owned(self) -> Err<(String, ErrorKind)> {
194 impl Err<error::Error<&[u8]>> {
197 pub fn to_owned(self) -> Err<error::Error<Vec<u8>>> {
203 impl Err<error::Error<&str>> {
206 pub fn to_owned(self) -> Err<error::Error<String>> {
211 impl<E: Eq> Eq for Err<E> {}
213 impl<E> fmt::Display for Err<E>
219 Err::Incomplete(Needed::Size(u)) => write!(f, "Parsing requires {} bytes/chars", u),
220 Err::Incomplete(Needed::Unknown) => write!(f, "Parsing requires more data"),
221 Err::Failure(c) => write!(f, "Parsing Failure: {:?}", c),
222 Err::Error(c) => write!(f, "Parsing Error: {:?}", c),
231 impl<E> Error for Err<E>
350 Err(e) => Err(e),
420 Err(Err::Error(e1)) => match self.g.parse(i) {
421 Err(Err::Error(e2)) => Err(Err::Error(e1.or(e2))),
452 Err(Err::Error(e)) => Err(Err::Error(e.into())),
453 Err(Err::Failure(e)) => Err(Err::Failure(e.into())),
454 Err(Err::Incomplete(e)) => Err(Err::Incomplete(e)),
480 assert_size!(Err<u32>, 16);
486 let e = Err::Error(1);
487 assert_eq!(e.map(|v| v + 1), Err::Error(2));