File tree 1 file changed +7
-3
lines changed
1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -339,14 +339,16 @@ impl<H: Header> DynSizedStructure<H> {
339
339
/// Performs a memory-safe same-size cast from the base-structure to a
340
340
/// specific [`MaybeDynSized`]. The idea here is to cast the generic
341
341
/// mostly semantic-free version to a specific type with fields that have
342
- /// a semantic.
342
+ /// a clear semantic.
343
343
///
344
344
/// The provided `T` of type [`MaybeDynSized`] might be may be sized type
345
- /// or DST. This depends on the type.
345
+ /// or DST. This depends on the type. However, the source and the target
346
+ /// both will have the same actual payload size and the same
347
+ /// [`size_of_val`].
346
348
///
347
349
/// # Panic
348
350
/// Panics if base assumptions are violated. For example, the
349
- /// `T` of type [`MaybeDynSized`] must allow a proper casting to it.
351
+ /// `T` of type [`MaybeDynSized`] must allow proper same-size casting to it.
350
352
///
351
353
/// # Safety
352
354
/// This function is safe due to various sanity checks and the overall
@@ -355,6 +357,8 @@ impl<H: Header> DynSizedStructure<H> {
355
357
/// # Panics
356
358
/// This panics if there is a size mismatch. However, this should never be
357
359
/// the case if all types follow their documented requirements.
360
+ ///
361
+ /// [`size_of_val`]: mem::size_of_val
358
362
pub fn cast < T : MaybeDynSized < Header = H > + ?Sized > ( & self ) -> & T {
359
363
let base_ptr = ptr:: addr_of!( * self ) ;
360
364
You can’t perform that action at this time.
0 commit comments