shared-memory: clippy fixes (docs)

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
Wolfgang Bumiller 2021-12-07 11:49:23 +01:00
parent 179515c5b2
commit d851078eae

View File

@ -192,12 +192,21 @@ impl <T: Sized + Init> SharedMemory<T> {
}
/// Helper to initialize nested data
///
/// # Safety
///
/// This calls `Init::initialize`, it is up to the user to ensure this is safe. The value should
/// not have been initialized at this point.
pub unsafe fn initialize_subtype<T: Init>(this: &mut T) {
let data: &mut MaybeUninit<T> = std::mem::transmute(this);
Init::initialize(data);
}
/// Helper to call 'check_type_magic' for nested data
///
/// # Safety
///
/// This calls `Init::check_type_magic`, it is up to the user to ensure this is safe.
pub unsafe fn check_subtype<T: Init>(this: &T) -> Result<(), Error> {
let data: &MaybeUninit<T> = std::mem::transmute(this);
Init::check_type_magic(data)