diff --git a/README.md b/README.md index 6a5151b9..e317d469 100644 --- a/README.md +++ b/README.md @@ -146,10 +146,11 @@ trait will be in scope when you add the following code: use derive_more::with_trait::Display; // also imports `core::fmt::Display` ``` -By default, derive macros only, without the corresponding traits, are import from -the crate's root: +By default, derive macros only, without the corresponding traits, are imported from +the crate's root (or from the `derive` module): ```rust -use derive_more::Display; // imports macro only +use derive_more::Display; // imports macro only +use derive_more::derive::*; // imports all macros only ``` #### Hygiene diff --git a/impl/src/try_from.rs b/impl/src/try_from.rs index a338950a..38654ec0 100644 --- a/impl/src/try_from.rs +++ b/impl/src/try_from.rs @@ -123,7 +123,8 @@ impl ToTokens for Expansion { quote! { #[automatically_derived] - impl #impl_generics derive_more::core::convert::TryFrom<#repr_ty #ty_generics> for #ident #where_clause { + impl #impl_generics derive_more::core::convert::TryFrom<#repr_ty #ty_generics> + for #ident #where_clause { type Error = #error; #[allow(non_upper_case_globals)] diff --git a/src/lib.rs b/src/lib.rs index 0832353a..e878f5df 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -114,6 +114,17 @@ pub use crate::try_unwrap::TryUnwrapError; #[doc(inline)] pub use derive_more_impl::*; +/// Module containing derive definitions only, without their corresponding traits. +/// +/// Use it in your import paths, if you don't want to import traits, but only macros. +pub mod derive { + // This can be unused if no feature is enabled. We already error in that case, but this warning + // distracts from that error. So we suppress the warning. + #[allow(unused_imports)] + #[doc(inline)] + pub use derive_more_impl::*; +} + /// Module containing derive definitions with their corresponding traits along. /// /// Use it in your import paths, if you do want to import derives along with their traits.