7
7
//! The easiest way to convert [Pest] grammars to Ion is from a `str` slice:
8
8
//!
9
9
//! ```
10
- //! use pestion ::*;
10
+ //! use pest_ion ::*;
11
11
//! use ion_rs::value::*;
12
12
//! use ion_rs::value::reader::*;
13
13
//!
14
- //! fn main() -> PestionResult <()> {
14
+ //! fn main() -> PestToIonResult <()> {
15
15
//! // parse a Pest grammar and convert it to Ion element
16
16
//! let actual = r#"a = @{ "a" | "b" ~ "c" }"#.try_pest_to_element()?;
17
17
//!
@@ -60,7 +60,7 @@ pub trait TryPestToElement {
60
60
///
61
61
/// This returns `Err` if the the conversion fails. For example, this can happen if the
62
62
/// source is not a valid Pest grammar.
63
- fn try_pest_to_element ( & self ) -> PestionResult < Self :: Element > ;
63
+ fn try_pest_to_element ( & self ) -> PestToIonResult < Self :: Element > ;
64
64
}
65
65
66
66
/// Infallible conversion of a Pest grammar (or part of a grammar) into Ion [`Element`].
@@ -78,7 +78,7 @@ impl TryPestToElement for &str {
78
78
type Element = OwnedElement ;
79
79
80
80
/// Parses a `str` slice as a Pest grammar and serializes the AST into [`Element`].
81
- fn try_pest_to_element ( & self ) -> PestionResult < Self :: Element > {
81
+ fn try_pest_to_element ( & self ) -> PestToIonResult < Self :: Element > {
82
82
let pairs = PestParser :: parse ( Rule :: grammar_rules, * self ) ?;
83
83
let ast = match consume_rules ( pairs) {
84
84
Ok ( ast) => ast,
@@ -422,7 +422,7 @@ mod tests {
422
422
},
423
423
}"#
424
424
) ]
425
- fn good < T , S > ( #[ case] input : T , #[ case] ion_literal : S ) -> PestionResult < ( ) >
425
+ fn good < T , S > ( #[ case] input : T , #[ case] ion_literal : S ) -> PestToIonResult < ( ) >
426
426
where
427
427
T : TryPestToElement < Element = OwnedElement > + Debug ,
428
428
S : AsRef < str > ,
@@ -452,9 +452,9 @@ mod tests {
452
452
#[ case:: empty_rule( r#"a = {}"# ) ]
453
453
#[ case:: self_reference( r#"a = { a }"# ) ]
454
454
#[ case:: double_rule( r#"a = { "a" }\n a = { "b" }"# ) ]
455
- fn pest_errors < T : TryPestToElement > ( #[ case] input : T ) -> PestionResult < ( ) > {
455
+ fn pest_errors < T : TryPestToElement > ( #[ case] input : T ) -> PestToIonResult < ( ) > {
456
456
match input. try_pest_to_element ( ) {
457
- Err ( PestionError :: Pest ( _) ) => { }
457
+ Err ( PestToIonError :: Pest ( _) ) => { }
458
458
something => {
459
459
unreachable ! ( "Got result we did not expect: {:?}" , something) ;
460
460
}
0 commit comments