Skip to content

Commit

Permalink
format_code_in_doc_comments = true
Browse files Browse the repository at this point in the history
Summary: D52632085

Reviewed By: dtolnay

Differential Revision: D52644229

fbshipit-source-id: 5acf67f9fae4e28beac55f9c7f07c4f4e8bb43e6
  • Loading branch information
stepancheg authored and facebook-github-bot committed Jan 10, 2024
1 parent 107d598 commit 2784507
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
12 changes: 8 additions & 4 deletions allocative/allocative/src/flamegraph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -281,18 +281,22 @@ unsafe impl Send for VisitedSharedPointer {}
/// # Example
///
/// ```
/// use allocative::FlameGraphBuilder;
/// use allocative::Allocative;
/// use allocative::FlameGraphBuilder;
///
/// #[derive(Allocative)]
/// struct Foo {
/// data: String,
/// };
///
/// let foo1 = Foo { data: "Hello, world!".to_owned() };
/// let foo2 = Foo { data: "Another message!".to_owned() };
/// let foo1 = Foo {
/// data: "Hello, world!".to_owned(),
/// };
/// let foo2 = Foo {
/// data: "Another message!".to_owned(),
/// };
///
/// let mut flamegraph = FlameGraphBuilder::default();
/// let mut flamegraph = FlameGraphBuilder::default();
/// flamegraph.visit_root(&foo1);
/// flamegraph.visit_root(&foo2);
/// let flamegraph_src = flamegraph.finish().flamegraph();
Expand Down
14 changes: 12 additions & 2 deletions allocative/allocative/src/size_of.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,12 @@ use crate::Visitor;
/// data: Vec<u8>,
/// }
///
/// assert_eq!(3, allocative::size_of_unique_allocated_data(&Foo { data: vec![10, 20, 30] }));
/// assert_eq!(
/// 3,
/// allocative::size_of_unique_allocated_data(&Foo {
/// data: vec![10, 20, 30]
/// })
/// );
/// ```
pub fn size_of_unique_allocated_data(root: &dyn Allocative) -> usize {
struct SizeOfUniqueAllocatedDataVisitor {
Expand Down Expand Up @@ -91,7 +96,12 @@ pub fn size_of_unique_allocated_data(root: &dyn Allocative) -> usize {
/// data: Vec<u8>,
/// }
///
/// assert_eq!(3 + std::mem::size_of::<Vec<u8>>(), allocative::size_of_unique(&Foo { data: vec![10, 20, 30] }));
/// assert_eq!(
/// 3 + std::mem::size_of::<Vec<u8>>(),
/// allocative::size_of_unique(&Foo {
/// data: vec![10, 20, 30]
/// })
/// );
/// ```
pub fn size_of_unique<T>(root: &T) -> usize
where
Expand Down

0 comments on commit 2784507

Please sign in to comment.