diff --git a/src/lib.rs b/src/lib.rs index 6893330..63df4e3 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -46,11 +46,11 @@ use types::*; /// ``` #[doc = include_str!("../examples/default_impl.rs")] /// ``` -/// -/// ## Unsafe Implementation -/// ``` -#[doc = include_str!("../examples/unsafe_impl.rs")] -/// ``` +#[cfg_attr(feature = "unsafe_impl", doc = "")] +#[cfg_attr(feature = "unsafe_impl", doc = "## Unsafe Implementation")] +#[cfg_attr(feature = "unsafe_impl", doc = "```")] +#[cfg_attr(feature = "unsafe_impl", doc = include_str!("../examples/unsafe_impl.rs"))] +#[cfg_attr(feature = "unsafe_impl", doc = "```")] pub struct ContiguousMemory< Impl: ImplDetails = ImplDefault, A: ManageMemory = DefaultMemoryManager, @@ -463,7 +463,7 @@ impl, A: ManageMemory> ContiguousMemory { /// use contiguous_mem::ContiguousMemory; /// /// let mut s: ContiguousMemory = ContiguousMemory::new(); - /// + /// /// assert!(s.try_grow_to(1024).is_ok()); /// /// let required_size: usize = usize::MAX; // bad read? diff --git a/src/memory.rs b/src/memory.rs index 4ccf140..477ce75 100644 --- a/src/memory.rs +++ b/src/memory.rs @@ -236,7 +236,8 @@ impl SegmentTracker { /// /// ``` /// # use contiguous_mem::range::ByteRange; - /// # use contiguous_mem::memory::{alloc::Layout, SegmentTracker}; + /// # use contiguous_mem::memory::SegmentTracker; + /// # use core::alloc::Layout; /// let mut tracker = SegmentTracker::new(1024); /// /// let layout = Layout::from_size_align(128, 8).unwrap(); @@ -263,7 +264,8 @@ impl SegmentTracker { /// # Examples /// ``` /// # use contiguous_mem::range::ByteRange; - /// # use contiguous_mem::memory::{alloc::Layout, SegmentTracker}; + /// # use contiguous_mem::memory::SegmentTracker; + /// # use core::alloc::Layout; /// let mut tracker = SegmentTracker::new(1024); /// /// let range = tracker