Aeledfyr / deepsize

A rust crate to find the total size of an object, on the stack and on the heap
MIT License
103 stars 19 forks source link

Use `as_bytes_with_nul` for deepsize of `CString` #27

Open lopopolo opened 2 years ago

lopopolo commented 2 years ago

CString::as_bytes_with_nul is cheap to call - it directly returns a reference to the inner byte slice.

as_bytes_with_nul performs no allocations or validations.

See:

as_bytes_with_nul has been stable since Rust 1.0.0.