diff --git a/src/custom.rs b/src/custom.rs index 22e44cc..76725bc 100644 --- a/src/custom.rs +++ b/src/custom.rs @@ -5,6 +5,7 @@ pub unsafe trait RefCastCustom { fn __static_assert() {} } +#[doc(hidden)] pub unsafe trait RefCastOkay: Sealed { type CurrentCrate; type Target: ?Sized; @@ -28,6 +29,7 @@ where type Target = To; } +#[doc(hidden)] pub trait Sealed {} impl<'a, From, To> Sealed<&'a From> for &'a To @@ -44,8 +46,10 @@ where { } +#[doc(hidden)] pub type CurrentCrate = >::CurrentCrate; +#[doc(hidden)] pub fn ref_cast_custom(_arg: From) where To: RefCastOkay, diff --git a/src/layout.rs b/src/layout.rs index 3f5e213..13f9196 100644 --- a/src/layout.rs +++ b/src/layout.rs @@ -1,7 +1,9 @@ use core::{mem, usize}; +#[doc(hidden)] pub struct Layout(T); +#[doc(hidden)] pub trait LayoutUnsized { const SIZE: usize = usize::MAX; const ALIGN: usize = usize::MAX; @@ -14,6 +16,7 @@ impl Layout { pub const ALIGN: usize = mem::align_of::(); } +#[doc(hidden)] #[inline] pub fn assert_layout( name: &'static str, diff --git a/src/lib.rs b/src/lib.rs index bbc6a59..776801a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -182,8 +182,12 @@ pub trait RefCast { // Not public API. #[doc(hidden)] pub mod __private { + #[doc(hidden)] pub use crate::custom::{ref_cast_custom, CurrentCrate, RefCastCustom}; + #[doc(hidden)] pub use crate::layout::{assert_layout, Layout, LayoutUnsized}; + #[doc(hidden)] pub use crate::trivial::assert_trivial; + #[doc(hidden)] pub use core::mem::transmute; } diff --git a/src/trivial.rs b/src/trivial.rs index bcda772..b3e6d0d 100644 --- a/src/trivial.rs +++ b/src/trivial.rs @@ -2,6 +2,7 @@ use core::marker::PhantomData; #[cfg(not(no_phantom_pinned))] use core::marker::PhantomPinned; +#[doc(hidden)] pub trait Trivial {} impl Trivial for () {} @@ -10,4 +11,5 @@ impl Trivial for PhantomData {} #[cfg(not(no_phantom_pinned))] impl Trivial for PhantomPinned {} +#[doc(hidden)] pub fn assert_trivial() {}