cargo fmt
This commit is contained in:
parent
f15488194c
commit
377d515d40
@ -1,12 +1,12 @@
|
||||
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct Representation {
|
||||
val: String
|
||||
val: String,
|
||||
}
|
||||
|
||||
impl Representation {
|
||||
pub fn new(from: &str) -> Self {
|
||||
Self { val: from.to_string() }
|
||||
Self {
|
||||
val: from.to_string(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -50,15 +50,18 @@ where
|
||||
F: Fn(&O) -> bool,
|
||||
{
|
||||
let orig_rep = parser.representation();
|
||||
(move |input| {
|
||||
parser.parse(input).and_then(|(result, rest)| {
|
||||
if pred_fn(&result) {
|
||||
Ok((result, rest))
|
||||
} else {
|
||||
Err(rest)
|
||||
}
|
||||
})
|
||||
}, Representation::new(&format!("{:?} if <PREDICATE>", orig_rep)))
|
||||
(
|
||||
move |input| {
|
||||
parser.parse(input).and_then(|(result, rest)| {
|
||||
if pred_fn(&result) {
|
||||
Ok((result, rest))
|
||||
} else {
|
||||
Err(rest)
|
||||
}
|
||||
})
|
||||
},
|
||||
Representation::new(&format!("{:?} if <PREDICATE>", orig_rep)),
|
||||
)
|
||||
}
|
||||
|
||||
/// Parses a standard identifier in a programming language
|
||||
|
Loading…
Reference in New Issue
Block a user