From a9b671c7c3d7373cd27d47a69a3e763cb0c3706b Mon Sep 17 00:00:00 2001 From: Nicolas Silva Date: Tue, 19 Jun 2018 04:41:00 -0700 Subject: [PATCH 1/2] Make the unit a hidden public member instead of private. --- src/macros.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/macros.rs b/src/macros.rs index f828ec8c..66597388 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -18,7 +18,12 @@ macro_rules! define_matrix { $(#[$attr])* pub struct $name { $(pub $field: T,)+ - _unit: PhantomData<($($phantom),+)> + + // Keep this (secretly) public for the few cases where we would like to + // create static constants which currently can't be initialized with a + // function. + #[doc(hidden)] + pub _unit: PhantomData<($($phantom),+)> } impl Clone for $name { From 1d44b1638565b4bd28f7b5844da8bde3ada45d2c Mon Sep 17 00:00:00 2001 From: Nicolas Silva Date: Tue, 19 Jun 2018 04:48:32 -0700 Subject: [PATCH 2/2] Make the unit a hidden public member instead of private for Scale and Length. --- src/length.rs | 2 +- src/scale.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/length.rs b/src/length.rs index ed7f9172..d96fed48 100644 --- a/src/length.rs +++ b/src/length.rs @@ -35,7 +35,7 @@ use core::fmt; /// /// [`TypedScale`]: struct.TypedScale.html #[repr(C)] -pub struct Length(pub T, PhantomData); +pub struct Length(pub T, #[doc(hidden)] pub PhantomData); impl Clone for Length { fn clone(&self) -> Self { diff --git a/src/scale.rs b/src/scale.rs index 44d940a8..4772fa61 100644 --- a/src/scale.rs +++ b/src/scale.rs @@ -38,7 +38,7 @@ use {TypedPoint2D, TypedRect, TypedSize2D, TypedVector2D}; /// let one_foot_in_mm: Length = one_foot * mm_per_inch; /// ``` #[repr(C)] -pub struct TypedScale(pub T, PhantomData<(Src, Dst)>); +pub struct TypedScale(pub T, #[doc(hidden)] pub PhantomData<(Src, Dst)>); #[cfg(feature = "serde")] impl<'de, T, Src, Dst> Deserialize<'de> for TypedScale