Skip to content

Commit

Permalink
fix: follow upstream change of std::process::Termination (#26)
Browse files Browse the repository at this point in the history
* fix: follow upstream change of `std::process::Termination`

* refactor: remove unused nightly feature gate

* docs: update docs
  • Loading branch information
yuhr authored Feb 9, 2022
1 parent 40a6c65 commit 8f7bdc7
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,4 +195,4 @@ That's why `fncmd` states “opinionated”. Showing authors on the help will si

The way it automatically determines which targets are subcommands or not requires the `#[fncmd]` macro itself to know the name of the attached target, and thus the path of the file at which it has been called. This can be achieved by [`Span::source_file`](https://doc.rust-lang.org/proc_macro/struct.Span.html#method.source_file), which is behind an unstable feature flag `proc_macro_span`.

Additionally, in order to allow users to use different return types for subcommand functions, it uses [`std::process::Termination`](https://doc.rust-lang.org/std/process/trait.Termination.html) trait internally, which is behind `termination_trait_lib`.
Additionally, in order to allow users to use different return types for subcommand functions, it uses [`std::process::Termination`](https://doc.rust-lang.org/std/process/trait.Termination.html) trait internally, which is behind `termination_trait_lib` and `process_exitcode_placeholder`.
4 changes: 2 additions & 2 deletions src/exit_code.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/// An intermediate type to abstract over various return types from subcommand
/// functions.
pub struct ExitCode(i32);
pub struct ExitCode(std::process::ExitCode);

pub trait IntoExitCode {
fn into_exit_code(self) -> ExitCode;
Expand All @@ -13,7 +13,7 @@ impl<T: std::process::Termination> IntoExitCode for T {
}

impl std::process::Termination for ExitCode {
fn report(self) -> i32 {
fn report(self) -> std::process::ExitCode {
self.0
}
}
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![feature(termination_trait_lib, trait_alias)]
#![feature(termination_trait_lib, process_exitcode_placeholder)]
#![doc = include_str!("../README.md")]

pub use fncmd_impl::fncmd;
Expand Down

0 comments on commit 8f7bdc7

Please sign in to comment.