1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
//! Methods for working with raw pointers.
//!
//! The lazy reader and writer APIs use a bump allocator to cheaply create and discard buffers
//! and collections in the process of encoding and decoding. The bump allocator's contents remain
//! valid as long as necessary; the owning reader or writer calling `reset()` when
//! they are no longer required. This allows state to be preserved across top-level method
//! calls, but the lifetime of that state is not something that can be statically verified
//! by the current version of the borrow checker. (Polonius may address this to some extent.)
//!
//! The methods in this module are used to manually define the lifetime of values that reside
//! in the bump allocator and which must also be available across top-level method calls.
/// Helper function that turns a raw pointer into a mutable reference of the specified type.
///
/// The caller is responsible for confirming that `ptr` is a valid reference to some value
/// of type `T`.
pub unsafe
/// Helper function that turns a raw pointer into an immutable reference of the specified type.
///
/// The caller is responsible for confirming that `ptr` is a valid reference to some value
/// of type `T`.
pub unsafe
/// Helper function that turns a mutable reference into a raw pointer.
///
/// Because this method does not read the data to which the reference points,
/// it is not considered `unsafe`.
pub