Skip to content

Commit

Permalink
Add saftey docs for PreallocatedContext trait
Browse files Browse the repository at this point in the history
Add `# Safety` section to the rustdocs of the `PrealocatedContext`
trait. This change was back ported manually (instead of directly
cherry-picking the patch) so as to add a blank newline after the heading
as is customary.

Original: `commit 1e6eb6c`
  • Loading branch information
tcharding committed Dec 5, 2022
1 parent 2b9a5b6 commit 989bf05
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,12 @@ unsafe impl<'buf> Context for AllPreallocated<'buf> {

/// Trait marking that a particular context object internally points to
/// memory that must outlive `'a`
///
/// # Safety
///
/// This trait is used internally to gate which context markers can safely
/// be used with the `preallocated_gen_new` function. Do not implement it
/// on your own structures.
pub unsafe trait PreallocatedContext<'a> {}

unsafe impl<'buf> PreallocatedContext<'buf> for AllPreallocated<'buf> {}
Expand Down

0 comments on commit 989bf05

Please sign in to comment.