Skip to content

Commit

Permalink
chore: where possible replace async-trait with native async trait s…
Browse files Browse the repository at this point in the history
…upport in 1.75+ (reubeno#197)

Reduce usage of the async-trait crate where possible, using the async_fn_in_trait native feature in 1.75+.
  • Loading branch information
39555 committed Oct 24, 2024
1 parent ea8fa26 commit 72fea42
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions brush-shell/src/shell_factory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,30 @@ impl AsMut<brush_core::Shell> for StubShell {
}
}

pub(crate) struct RustylineShellFactory;

impl ShellFactory for RustylineShellFactory {
#[cfg(all(feature = "rustyline", any(windows, unix)))]
type ShellType = brush_interactive::RustylineShell;
#[cfg(any(not(feature = "rustyline"), not(any(windows, unix))))]
type ShellType = StubShell;

#[allow(unused)]
async fn create(
&self,
options: &brush_interactive::Options,
) -> Result<Self::ShellType, brush_interactive::ShellError> {
#[cfg(all(feature = "rustyline", any(windows, unix)))]
{
brush_interactive::RustylineShell::new(options).await
}
#[cfg(any(not(feature = "rustyline"), not(any(windows, unix))))]
{
Err(brush_interactive::ShellError::InputBackendNotSupported)
}
}
}

pub(crate) struct ReedlineShellFactory;

impl ShellFactory for ReedlineShellFactory {
Expand Down

0 comments on commit 72fea42

Please sign in to comment.