pub mod basic;
use std::sync::Arc;
use derive_more::with_trait::{Display, Error as StdError};
use futures::Stream;
#[doc(inline)]
pub use self::basic::Basic;
use crate::feature::ExpandExamplesError;
pub trait Parser<I> {
type Cli: clap::Args;
type Output: Stream<Item = Result<gherkin::Feature>> + 'static;
fn parse(self, input: I, cli: Self::Cli) -> Self::Output;
}
#[expect(clippy::absolute_paths, reason = "one liner")]
pub type Result<T> = std::result::Result<T, Error>;
#[derive(Clone, Debug, Display, StdError)]
pub enum Error {
#[display("Failed to parse feature: {_0}")]
Parsing(Arc<gherkin::ParseFileError>),
#[display("Failed to expand examples: {_0}")]
ExampleExpansion(Arc<ExpandExamplesError>),
}
impl From<gherkin::ParseFileError> for Error {
fn from(e: gherkin::ParseFileError) -> Self {
Self::Parsing(Arc::new(e))
}
}
impl From<ExpandExamplesError> for Error {
fn from(e: ExpandExamplesError) -> Self {
Self::ExampleExpansion(Arc::new(e))
}
}