From c2ad74ff1527bc39bdc85ef8ef7dd68b5985a1e7 Mon Sep 17 00:00:00 2001 From: finga Date: Wed, 30 Jun 2021 22:46:33 +0200 Subject: [PATCH] Remove `pub` declarations and move to `posix::*` This is in order to prepare also for SysV message queues. --- src/main.rs | 31 +++++++++++++------------------ src/posix.rs | 11 +++++++++++ src/{ => posix}/create.rs | 0 src/{ => posix}/info.rs | 0 src/{ => posix}/recv.rs | 0 src/{ => posix}/send.rs | 0 src/{ => posix}/unlink.rs | 0 7 files changed, 24 insertions(+), 18 deletions(-) create mode 100644 src/posix.rs rename src/{ => posix}/create.rs (100%) rename src/{ => posix}/info.rs (100%) rename src/{ => posix}/recv.rs (100%) rename src/{ => posix}/send.rs (100%) rename src/{ => posix}/unlink.rs (100%) diff --git a/src/main.rs b/src/main.rs index a8a6481..ba152c7 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,12 +1,16 @@ -use crate::{create::Create, info::Info, recv::Recv, send::Send, unlink::Unlink}; use anyhow::Result; use clap::{crate_authors, crate_version, AppSettings, Clap}; -mod create; -mod info; -mod recv; -mod send; -mod unlink; +mod posix; + +#[derive(Clap, Debug)] +enum Command { + Create(posix::Create), + Info(posix::Info), + Unlink(posix::Unlink), + Send(posix::Send), + Recv(posix::Recv), +} #[derive(Clap, Debug)] #[clap( @@ -16,21 +20,12 @@ mod unlink; global_setting = AppSettings::VersionlessSubcommands, global_setting = AppSettings::InferSubcommands, )] -pub struct Opts { +struct Opts { /// Produce verbose output #[clap(short, long, global = true)] - pub verbose: bool, + verbose: bool, #[clap(subcommand)] - pub command: Command, -} - -#[derive(Clap, Debug)] -pub enum Command { - Create(Create), - Info(Info), - Unlink(Unlink), - Send(Send), - Recv(Recv), + command: Command, } fn main() -> Result<()> { diff --git a/src/posix.rs b/src/posix.rs new file mode 100644 index 0000000..d9e6266 --- /dev/null +++ b/src/posix.rs @@ -0,0 +1,11 @@ +mod create; +mod info; +mod recv; +mod send; +mod unlink; + +pub use create::Create; +pub use info::Info; +pub use recv::Recv; +pub use send::Send; +pub use unlink::Unlink; diff --git a/src/create.rs b/src/posix/create.rs similarity index 100% rename from src/create.rs rename to src/posix/create.rs diff --git a/src/info.rs b/src/posix/info.rs similarity index 100% rename from src/info.rs rename to src/posix/info.rs diff --git a/src/recv.rs b/src/posix/recv.rs similarity index 100% rename from src/recv.rs rename to src/posix/recv.rs diff --git a/src/send.rs b/src/posix/send.rs similarity index 100% rename from src/send.rs rename to src/posix/send.rs diff --git a/src/unlink.rs b/src/posix/unlink.rs similarity index 100% rename from src/unlink.rs rename to src/posix/unlink.rs