File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -392,6 +392,8 @@ impl GroupMutIter<'_> {
392392 }
393393 }
394394 /// Inserts the given entry data at the right spot.
395+ /// Precondition: The caller already grew the group by
396+ /// `payload_size + size_of::<ENTRY_HEADER>()`
395397 #[ allow( clippy:: too_many_arguments) ]
396398 pub ( crate ) fn insert_entry (
397399 & mut self ,
@@ -566,6 +568,9 @@ impl GroupMutItem<'_> {
566568 Ok ( entry_size as u32 )
567569 }
568570 /// Resizes the given entry by SIZE_DIFF.
571+ /// Precondition: If `size_diff > 0`, the caller must have already
572+ /// expanded the group `size_diff`. If `size_diff < 0`, the caller
573+ /// must call `resize_entry_by` before resizing the group.
569574 pub ( crate ) fn resize_entry_by (
570575 & mut self ,
571576 entry_id : EntryId ,
@@ -634,6 +639,8 @@ impl GroupMutItem<'_> {
634639 }
635640 }
636641 /// Inserts the given token.
642+ /// Precondition: Caller already increased the group size by
643+ /// `size_of::<TOKEN_ENTRY>()`.
637644 pub ( crate ) fn insert_token (
638645 & mut self ,
639646 entry_id : EntryId ,
Original file line number Diff line number Diff line change @@ -203,6 +203,8 @@ impl<'a> TokensEntryIter<&'a mut [u8]> {
203203 }
204204
205205 /// Inserts the given entry data at the right spot.
206+ /// Precondition: Caller must have already increased the group size
207+ /// by `size_of::<TOKEN_ENTRY>()`.
206208 pub ( crate ) fn insert_token (
207209 & mut self ,
208210 token_id : u32 ,
@@ -602,6 +604,8 @@ impl TokensEntryBodyItem<&mut [u8]> {
602604 ( self . iter_mut ( ) . ok ( ) ?) . find ( |entry| entry. id ( ) == token_id)
603605 }
604606
607+ /// Precondition: Caller already increased the group size by
608+ /// `size_of::<TOKEN_ENTRY>()`.
605609 pub ( crate ) fn insert_token (
606610 & mut self ,
607611 token_id : u32 ,
You can’t perform that action at this time.
0 commit comments