Skip to content

Commit

Permalink
Switch to clap v3 for examples.
Browse files Browse the repository at this point in the history
  • Loading branch information
de-vri-es committed Apr 20, 2022
1 parent 4048991 commit ef4f2a0
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 39 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Unreleased
- [fix][minor] Fix unintended infinite recursion in generic trait implementations.
- [change][patch] Switch to `clap` v3 in the examples.

# Version 0.5.0-alpha8 - 2022-01-25
- [rename][major] Rename `crate::util::format` module to `crate::format`.
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ fizyr-rpc-macros = { version = "=0.5.0-alpha8", path = "macros", optional = true

[dev-dependencies]
assert2 = "0.3.3"
clap = { version = "3.1.10", features = ["derive"] }
tokio = { version = "1.0.0", features = ["macros"] }
fizyr-rpc = { path = ".", features = ["unix-seqpacket", "unix-stream", "tcp"] }
structopt = "0.3.18"
memfile = "0.2.0"

[package.metadata.docs.rs]
Expand Down
11 changes: 4 additions & 7 deletions examples/tcp-client.rs
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
use fizyr_rpc::TcpPeer;
use structopt::StructOpt;

#[derive(StructOpt)]
#[structopt(setting = structopt::clap::AppSettings::ColoredHelp)]
#[structopt(setting = structopt::clap::AppSettings::UnifiedHelpMessage)]
#[structopt(setting = structopt::clap::AppSettings::DeriveDisplayOrder)]
#[derive(clap::Parser)]
#[clap(setting = clap::AppSettings::DeriveDisplayOrder)]
struct Options {
#[structopt(default_value = "localhost:12345")]
#[clap(default_value = "localhost:12345")]
address: String,
}

#[tokio::main(flavor = "current_thread")]
async fn main() {
if let Err(e) = do_main(&Options::from_args()).await {
if let Err(e) = do_main(&clap::Parser::parse()).await {
eprintln!("Error: {}", e);
std::process::exit(1);
}
Expand Down
11 changes: 4 additions & 7 deletions examples/tcp-server.rs
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
use fizyr_rpc::TcpListener;
use structopt::StructOpt;

#[derive(StructOpt)]
#[structopt(setting = structopt::clap::AppSettings::ColoredHelp)]
#[structopt(setting = structopt::clap::AppSettings::UnifiedHelpMessage)]
#[structopt(setting = structopt::clap::AppSettings::DeriveDisplayOrder)]
#[derive(clap::Parser)]
#[clap(setting = clap::AppSettings::DeriveDisplayOrder)]
struct Options {
#[structopt(default_value = "[::]:12345")]
#[clap(default_value = "[::]:12345")]
bind: String,
}

#[tokio::main(flavor = "current_thread")]
async fn main() {
if let Err(e) = do_main(&Options::from_args()).await {
if let Err(e) = do_main(&clap::Parser::parse()).await {
eprintln!("Error: {}", e);
std::process::exit(1);
}
Expand Down
9 changes: 3 additions & 6 deletions examples/unix-seqpacket-client.rs
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
use fizyr_rpc::UnixSeqpacketPeer;

use std::path::PathBuf;
use structopt::StructOpt;

#[derive(StructOpt)]
#[structopt(setting = structopt::clap::AppSettings::ColoredHelp)]
#[structopt(setting = structopt::clap::AppSettings::UnifiedHelpMessage)]
#[structopt(setting = structopt::clap::AppSettings::DeriveDisplayOrder)]
#[derive(clap::Parser)]
#[clap(setting = clap::AppSettings::DeriveDisplayOrder)]
struct Options {
socket: PathBuf,
}

#[tokio::main(flavor = "current_thread")]
async fn main() {
if let Err(e) = do_main(&Options::from_args()).await {
if let Err(e) = do_main(&clap::Parser::parse()).await {
eprintln!("Error: {}", e);
std::process::exit(1);
}
Expand Down
9 changes: 3 additions & 6 deletions examples/unix-seqpacket-server.rs
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
use fizyr_rpc::UnixSeqpacketListener;
use std::path::PathBuf;
use structopt::StructOpt;

#[derive(StructOpt)]
#[structopt(setting = structopt::clap::AppSettings::ColoredHelp)]
#[structopt(setting = structopt::clap::AppSettings::UnifiedHelpMessage)]
#[structopt(setting = structopt::clap::AppSettings::DeriveDisplayOrder)]
#[derive(clap::Parser)]
#[clap(setting = clap::AppSettings::DeriveDisplayOrder)]
struct Options {
socket: PathBuf,
}

#[tokio::main(flavor = "current_thread")]
async fn main() {
if let Err(e) = do_main(&Options::from_args()).await {
if let Err(e) = do_main(&clap::Parser::parse()).await {
eprintln!("Error: {}", e);
std::process::exit(1);
}
Expand Down
9 changes: 3 additions & 6 deletions examples/unix-stream-client.rs
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
use fizyr_rpc::UnixStreamPeer;

use std::path::PathBuf;
use structopt::StructOpt;

#[derive(StructOpt)]
#[structopt(setting = structopt::clap::AppSettings::ColoredHelp)]
#[structopt(setting = structopt::clap::AppSettings::UnifiedHelpMessage)]
#[structopt(setting = structopt::clap::AppSettings::DeriveDisplayOrder)]
#[derive(clap::Parser)]
#[clap(setting = clap::AppSettings::DeriveDisplayOrder)]
struct Options {
socket: PathBuf,
}

#[tokio::main(flavor = "current_thread")]
async fn main() {
if let Err(e) = do_main(&Options::from_args()).await {
if let Err(e) = do_main(&clap::Parser::parse()).await {
eprintln!("Error: {}", e);
std::process::exit(1);
}
Expand Down
9 changes: 3 additions & 6 deletions examples/unix-stream-server.rs
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
use fizyr_rpc::UnixStreamListener;
use std::path::PathBuf;
use structopt::StructOpt;

#[derive(StructOpt)]
#[structopt(setting = structopt::clap::AppSettings::ColoredHelp)]
#[structopt(setting = structopt::clap::AppSettings::UnifiedHelpMessage)]
#[structopt(setting = structopt::clap::AppSettings::DeriveDisplayOrder)]
#[derive(clap::Parser)]
#[clap(setting = clap::AppSettings::DeriveDisplayOrder)]
struct Options {
socket: PathBuf,
}

#[tokio::main(flavor = "current_thread")]
async fn main() {
if let Err(e) = do_main(&Options::from_args()).await {
if let Err(e) = do_main(&clap::Parser::parse()).await {
eprintln!("Error: {}", e);
std::process::exit(1);
}
Expand Down

0 comments on commit ef4f2a0

Please sign in to comment.