diff options
author | Nick Mathewson <nickm@torproject.org> | 2024-02-15 09:41:09 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2024-03-13 09:38:20 -0400 |
commit | ee51a040e5d4f048c22e0093b2b967ad2a4382a9 (patch) | |
tree | ddc634b54df82af022a71030acdc0c4651b10324 | |
parent | 1268d502dc00884c29615d504792dcc3e8aced23 (diff) | |
download | arti-ee51a040e5d4f048c22e0093b2b967ad2a4382a9.tar.gz arti-ee51a040e5d4f048c22e0093b2b967ad2a4382a9.zip |
tor_config: Hide macro-only re-exports.
Our macros use these exports, but we don't need everybody else to
be able to see them.
-rw-r--r-- | Cargo.lock | 1 | ||||
-rw-r--r-- | crates/tor-config/semver.md | 1 | ||||
-rw-r--r-- | crates/tor-config/src/lib.rs | 21 | ||||
-rw-r--r-- | crates/tor-config/src/list_builder.rs | 8 |
4 files changed, 18 insertions, 13 deletions
diff --git a/Cargo.lock b/Cargo.lock index 742943325..650abfa7b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5803,7 +5803,6 @@ dependencies = [ "derive_builder_fork_arti", "fs-mistrust", "futures", - "itertools 0.12.1", "serde", "thiserror", "tokio", diff --git a/crates/tor-config/semver.md b/crates/tor-config/semver.md new file mode 100644 index 000000000..3fc18def1 --- /dev/null +++ b/crates/tor-config/semver.md @@ -0,0 +1 @@ +BREAKING: Several re-exported macro dependencies are now hidden. diff --git a/crates/tor-config/src/lib.rs b/crates/tor-config/src/lib.rs index 69c1b8203..a06194522 100644 --- a/crates/tor-config/src/lib.rs +++ b/crates/tor-config/src/lib.rs @@ -51,22 +51,27 @@ mod mut_cfg; mod path; pub mod sources; +#[doc(hidden)] +pub mod deps { + pub use config; + pub use educe; + pub use itertools::Itertools; + pub use paste::paste; + pub use serde; + pub use tor_basic_utils::macro_first_nonempty; +} + pub use cmdline::CmdLine; -pub use config as config_crate; -pub use educe; pub use err::{ConfigBuildError, ConfigError, ReconfigureError}; pub use flatten::{Flatten, Flattenable}; -pub use itertools::Itertools; pub use list_builder::{MultilineListBuilder, MultilineListBuilderError}; pub use load::{resolve, resolve_ignore_warnings, resolve_return_results}; pub use misc::*; pub use mut_cfg::MutCfg; -pub use paste::paste; pub use path::{CfgPath, CfgPathError}; -pub use serde; pub use sources::{ConfigurationSource, ConfigurationSources}; -pub use tor_basic_utils::macro_first_nonempty; +use itertools::Itertools; #[doc(hidden)] pub use derive_adhoc; @@ -383,7 +388,7 @@ macro_rules! impl_standard_builder { @ ( $($Builder :ident)? ) ( $($default :ident)? ) ( $($try_deserialize:ident)? ) $Config:ty : $(+)? - } => { $crate::paste!{ + } => { $crate::deps::paste!{ impl $Config { /// Returns a fresh, default, builder pub fn builder() -> [< $Config Builder >] { @@ -420,7 +425,7 @@ macro_rules! impl_standard_builder { if let Some(def) = def { $( // expands iff there was $try_deserialize, which is always try_deserialize - let empty_config = $crate::config_crate::Config::builder().build().unwrap(); + let empty_config = $crate::deps::config::Config::builder().build().unwrap(); let builder: [< $Config Builder >] = empty_config.$try_deserialize().unwrap(); let from_empty = builder.build().unwrap(); assert_eq!(def, from_empty); diff --git a/crates/tor-config/src/list_builder.rs b/crates/tor-config/src/list_builder.rs index d4bf0d5a0..98b399195 100644 --- a/crates/tor-config/src/list_builder.rs +++ b/crates/tor-config/src/list_builder.rs @@ -225,8 +225,8 @@ macro_rules! define_list_builder_helper { $( item_build: $item_build:expr; )? $(#[ serde $serde_attrs:tt ] )+ } => { - #[derive($crate::educe::Educe, Clone, Debug)] - #[derive($crate::serde::Serialize, $crate::serde::Deserialize)] + #[derive($crate::deps::educe::Educe, Clone, Debug)] + #[derive($crate::deps::serde::Serialize, $crate::deps::serde::Deserialize)] #[educe(Default)] $(#[ serde $serde_attrs ])+ $(#[ $docs_and_attrs ])* @@ -263,7 +263,7 @@ macro_rules! define_list_builder_helper { let $things = $things .iter() .map( - $crate::macro_first_nonempty!{ + $crate::deps::macro_first_nonempty!{ [ $( $item_build )? ], [ |item| item.build() ], } @@ -356,7 +356,7 @@ macro_rules! define_list_builder_accessors { )* } } => { - impl $OuterBuilder { $( $crate::paste!{ + impl $OuterBuilder { $( $crate::deps::paste!{ /// Access the being-built list (resolving default) /// /// If the field has not yet been set or accessed, the default list will be |