diff --git a/Cargo.toml b/Cargo.toml index 2e58de6..9d4a58c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,8 +1,8 @@ [package] name = "header-vec" -version = "0.1.3-alpha.0" +version = "0.1.3" authors = ["Geordon Worley "] -edition = "2018" +edition = "2021" description = "Vector with user-specified header, length, capacity, and array elements all stored on the heap together" documentation = "https://docs.rs/header-vec/" repository = "https://github.com/rust-cv/header-vec" diff --git a/examples/doc_example.rs b/examples/doc_example.rs index d977890..d75966c 100644 --- a/examples/doc_example.rs +++ b/examples/doc_example.rs @@ -3,6 +3,7 @@ use header_vec::HeaderVec; #[derive(Debug)] struct OurHeaderType { + #[allow(dead_code)] a: usize, } @@ -13,8 +14,16 @@ fn main() { hv.push('z'); println!( - "HeaderVec itself consists solely of a pointer, it's only {} bytes big.", + "[`HeaderVec`] itself consists solely of a pointer, it's only {} bytes big.", size_of_val(&hv) ); - println!("All of the data, like our header, {:?}, and the length of the vector: {}, resides on the other side of the pointer.", &*hv, hv.len()); + println!( + "All of the data, like our header `{:?}`, the length of the vector: `{}`,", + &*hv, + hv.len() + ); + println!( + "and the contents of the vector `{:?}` resides on the other side of the pointer.", + hv.as_slice() + ); } diff --git a/src/lib.rs b/src/lib.rs index 0918d7c..79f5b05 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -19,7 +19,7 @@ struct HeaderVecHeader { len: AtomicUsize, } -/// A vector with a header of your choosing, behind a thin pointer +/// A vector with a header of your choosing behind a thin pointer /// /// # Example /// @@ -36,15 +36,11 @@ struct HeaderVecHeader { /// let mut hv = HeaderVec::::new(h); /// hv.push('x'); /// hv.push('z'); -/// -/// println!("HeaderVec itself consists solely of a pointer, it's only {} bytes big.", size_of_val(&hv)); -/// println!("All of the data, like our header, {:?}, and the length of the vector: {}, resides on the other side of the pointer.", &*hv, hv.len()); /// ``` /// -/// ```ignore -/// HeaderVec itself consists solely of a pointer, it's only 8 bytes big. -/// All of the data, like our header, OurHeaderType { a: 2 }, and the length of the vector: 2, resides on the other side of the pointer. -/// ``` +/// [`HeaderVec`] itself consists solely of a pointer, it's only 8 bytes big. +/// All of the data, like our header `OurHeaderType { a: 2 }`, the length of the vector: `2`, +/// and the contents of the vector `['x', 'z']` resides on the other side of the pointer. pub struct HeaderVec { ptr: *mut T, _phantom: PhantomData,