Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Examples of using Context #5

Open
dtolnay opened this issue Feb 17, 2019 · 1 comment
Open

Examples of using Context #5

dtolnay opened this issue Feb 17, 2019 · 1 comment

Comments

@dtolnay
Copy link

dtolnay commented Feb 17, 2019

Currently none of the example code or documentation shows how to use Context. I would expect to see usage examples on this page:

https://docs.rs/deepsize/0.1.1/deepsize/struct.Context.html

@Aeledfyr

@stuhood
Copy link

stuhood commented Feb 27, 2022

The documentation also currently suggests that Context should become a private type before stabilization. But it can be quite useful to allow for re-using a Context across multiple calls.

For example: I would like to make multiple deep_size_of calls for known roots of an object graph (where objects are likely to contain Arcs sharing content), without those individual deep_size_of calls double-counting shared structure. The end result is still an accurate total, even though it might "blame" some of the deep size to one root rather than another based on the call order.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants