Skip to content

Commit 2076db3

Browse files
authored
Merge branch 'rust-cv:main' into main
2 parents d44385d + ff10458 commit 2076db3

File tree

3 files changed

+17
-12
lines changed

3 files changed

+17
-12
lines changed

Diff for: Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
[package]
22
name = "header-vec"
3-
version = "0.1.3-alpha.0"
3+
version = "0.1.3"
44
authors = ["Geordon Worley <[email protected]>"]
5-
edition = "2018"
5+
edition = "2021"
66
description = "Vector with user-specified header, length, capacity, and array elements all stored on the heap together"
77
documentation = "https://docs.rs/header-vec/"
88
repository = "https://github.com/rust-cv/header-vec"

Diff for: examples/doc_example.rs

+11-2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ use header_vec::HeaderVec;
33

44
#[derive(Debug)]
55
struct OurHeaderType {
6+
#[allow(dead_code)]
67
a: usize,
78
}
89

@@ -13,8 +14,16 @@ fn main() {
1314
hv.push('z');
1415

1516
println!(
16-
"HeaderVec itself consists solely of a pointer, it's only {} bytes big.",
17+
"[`HeaderVec`] itself consists solely of a pointer, it's only {} bytes big.",
1718
size_of_val(&hv)
1819
);
19-
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());
20+
println!(
21+
"All of the data, like our header `{:?}`, the length of the vector: `{}`,",
22+
&*hv,
23+
hv.len()
24+
);
25+
println!(
26+
"and the contents of the vector `{:?}` resides on the other side of the pointer.",
27+
hv.as_slice()
28+
);
2029
}

Diff for: src/lib.rs

+4-8
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ struct HeaderVecHeader<H> {
1919
len: AtomicUsize,
2020
}
2121

22-
/// A vector with a header of your choosing, behind a thin pointer
22+
/// A vector with a header of your choosing behind a thin pointer
2323
///
2424
/// # Example
2525
///
@@ -36,15 +36,11 @@ struct HeaderVecHeader<H> {
3636
/// let mut hv = HeaderVec::<OurHeaderType, char>::new(h);
3737
/// hv.push('x');
3838
/// hv.push('z');
39-
///
40-
/// println!("HeaderVec itself consists solely of a pointer, it's only {} bytes big.", size_of_val(&hv));
41-
/// 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());
4239
/// ```
4340
///
44-
/// ```ignore
45-
/// HeaderVec itself consists solely of a pointer, it's only 8 bytes big.
46-
/// 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.
47-
/// ```
41+
/// [`HeaderVec`] itself consists solely of a pointer, it's only 8 bytes big.
42+
/// All of the data, like our header `OurHeaderType { a: 2 }`, the length of the vector: `2`,
43+
/// and the contents of the vector `['x', 'z']` resides on the other side of the pointer.
4844
pub struct HeaderVec<H, T> {
4945
ptr: *mut T,
5046
_phantom: PhantomData<H>,

0 commit comments

Comments
 (0)