From 7421ae68ba180c1a15199c2e9b57cb5b170e91cb Mon Sep 17 00:00:00 2001 From: Geordon Worley Date: Mon, 16 Sep 2024 22:53:15 -0500 Subject: [PATCH 1/3] update doc comments --- src/lib.rs | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 3aabad4..2a94de8 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -18,7 +18,7 @@ struct HeaderVecHeader { len: usize, } -/// 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 /// @@ -35,15 +35,10 @@ 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 is the same size as a pointer to T. +/// All of the data, like our header, `OurHeaderType { a: 2 }`, the length of the vector: `2`, and the contents of the vector `['x', 'z']` reside on the other side of the pointer. pub struct HeaderVec { ptr: *mut T, _phantom: PhantomData, From 56956098c1ef2f2d820bae4740f60efb1f627bac Mon Sep 17 00:00:00 2001 From: Geordon Worley Date: Mon, 16 Sep 2024 22:56:31 -0500 Subject: [PATCH 2/3] update example to generate doc output --- examples/doc_example.rs | 13 +++++++++++-- src/lib.rs | 5 +++-- 2 files changed, 14 insertions(+), 4 deletions(-) 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 2a94de8..56968dd 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -37,8 +37,9 @@ struct HeaderVecHeader { /// hv.push('z'); /// ``` /// -/// [`HeaderVec`] itself consists solely of a pointer. It is the same size as a pointer to T. -/// All of the data, like our header, `OurHeaderType { a: 2 }`, the length of the vector: `2`, and the contents of the vector `['x', 'z']` reside 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, From ff10458a5a7a8f4d171ea6ab8d201e061d0a3834 Mon Sep 17 00:00:00 2001 From: Geordon Worley Date: Mon, 16 Sep 2024 22:57:36 -0500 Subject: [PATCH 3/3] bump version to v0.1.3; update edition to 2021 --- Cargo.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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"