From 9bdfc4b1138875af2fc603b77431c75a16db2bd7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tin=20=C5=A0vagelj?= Date: Fri, 22 Mar 2024 19:03:07 +0100 Subject: [PATCH] Guard unsafe impl example MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Tin Å vagelj --- src/lib.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) 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?