Skip to content

Commit e3bef9e

Browse files
committed
Renames as pre-requisites for the crate re-name.
* `PestionResult` => `PestToIonResult` * `PestionError` => `PestToIonError`
1 parent 783de7f commit e3bef9e

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

pestion/src/lib.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
//! use ion_rs::value::*;
1212
//! use ion_rs::value::reader::*;
1313
//!
14-
//! fn main() -> PestionResult<()> {
14+
//! fn main() -> PestToIonResult<()> {
1515
//! // parse a Pest grammar and convert it to Ion element
1616
//! let actual = r#"a = @{ "a" | "b" ~ "c" }"#.try_pest_to_element()?;
1717
//!
@@ -60,7 +60,7 @@ pub trait TryPestToElement {
6060
///
6161
/// This returns `Err` if the the conversion fails. For example, this can happen if the
6262
/// 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>;
6464
}
6565

6666
/// Infallible conversion of a Pest grammar (or part of a grammar) into Ion [`Element`].
@@ -78,7 +78,7 @@ impl TryPestToElement for &str {
7878
type Element = OwnedElement;
7979

8080
/// 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> {
8282
let pairs = PestParser::parse(Rule::grammar_rules, *self)?;
8383
let ast = match consume_rules(pairs) {
8484
Ok(ast) => ast,
@@ -422,7 +422,7 @@ mod tests {
422422
},
423423
}"#
424424
)]
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<()>
426426
where
427427
T: TryPestToElement<Element = OwnedElement> + Debug,
428428
S: AsRef<str>,
@@ -452,9 +452,9 @@ mod tests {
452452
#[case::empty_rule(r#"a = {}"#)]
453453
#[case::self_reference(r#"a = { a }"#)]
454454
#[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<()> {
456456
match input.try_pest_to_element() {
457-
Err(PestionError::Pest(_)) => {}
457+
Err(PestToIonError::Pest(_)) => {}
458458
something => {
459459
unreachable!("Got result we did not expect: {:?}", something);
460460
}

pestion/src/result.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
use thiserror::Error;
66

77
/// Main [`Result`] type for Pest to Ion.
8-
pub type PestionResult<T> = Result<T, PestionError>;
8+
pub type PestToIonResult<T> = Result<T, PestToIonError>;
99

1010
/// Error type for problems in this crate.
1111
#[derive(Error, Debug)]
12-
pub enum PestionError {
12+
pub enum PestToIonError {
1313
/// An error working with [`pest_meta`].
1414
#[error("Pest Error: {0}")]
1515
Pest(#[from] pest::error::Error<pest_meta::parser::Rule>),
@@ -24,6 +24,6 @@ pub enum PestionError {
2424
}
2525

2626
/// Convenience function to create a general error result.
27-
pub fn invalid<T, S: Into<String>>(message: S) -> PestionResult<T> {
28-
Err(PestionError::Invalid(message.into()))
27+
pub fn invalid<T, S: Into<String>>(message: S) -> PestToIonResult<T> {
28+
Err(PestToIonError::Invalid(message.into()))
2929
}

0 commit comments

Comments
 (0)