From 3630ab5d90815ee1b96d7a06f232127a1783436f Mon Sep 17 00:00:00 2001 From: Michael Watzko Date: Sat, 20 Jan 2024 13:55:16 +0100 Subject: [PATCH] Make protobuf actually optional (see feature flags) --- Cargo.toml | 6 ++++-- src/prelude.rs | 1 + src/protocol/mod.rs | 1 + src/rw/mod.rs | 4 ++++ 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 81866468..04e15c62 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -28,12 +28,14 @@ required-features = ["model", "clap"] [dependencies] backtrace = "0.3.69" -byteorder = "1.5.0" # feature asn1rs-* asn1rs-model = { version = "0.4.0", path = "asn1rs-model", optional = true } asn1rs-macros = { version = "0.4.0", path = "asn1rs-macros", optional = true } +# feature protobuf +byteorder = { version = "1.5.0", optional = true } + # for binary only clap = { version = "4.4.18", features = ["derive", "env"], optional = true } @@ -45,7 +47,7 @@ codegen = "0.2.0" [features] default = ["macros", "model", "clap"] -protobuf = ["asn1rs-model/protobuf"] +protobuf = ["asn1rs-model/protobuf", "byteorder"] macros = ["asn1rs-macros"] model = ["asn1rs-model"] debug-proc-macro = ["asn1rs-macros/debug-proc-macro", "asn1rs-model/debug-proc-macro"] diff --git a/src/prelude.rs b/src/prelude.rs index f422c713..b0d2658d 100644 --- a/src/prelude.rs +++ b/src/prelude.rs @@ -1,6 +1,7 @@ pub use crate::descriptor::prelude::*; #[cfg(feature = "macros")] pub use crate::macros::*; +#[cfg(feature = "protobuf")] pub use crate::protocol::protobuf::ProtobufEq; pub use crate::protocol::*; pub use crate::rw::*; diff --git a/src/protocol/mod.rs b/src/protocol/mod.rs index d70448c5..b46e0891 100644 --- a/src/protocol/mod.rs +++ b/src/protocol/mod.rs @@ -7,4 +7,5 @@ //! ``` pub mod per; +#[cfg(feature = "protobuf")] pub mod protobuf; diff --git a/src/rw/mod.rs b/src/rw/mod.rs index fdc9fe7a..cb23d30e 100644 --- a/src/rw/mod.rs +++ b/src/rw/mod.rs @@ -1,9 +1,13 @@ mod println; +#[cfg(feature = "protobuf")] mod proto_read; +#[cfg(feature = "protobuf")] mod proto_write; mod uper; pub use println::*; +#[cfg(feature = "protobuf")] pub use proto_read::*; +#[cfg(feature = "protobuf")] pub use proto_write::*; pub use uper::*;