Function pre::std::ptr::write[][src]

pub unsafe fn write<T>(dst: *mut T, src: T)
Expand description

std::ptr::write with preconditions.

This function behaves exactly like std::ptr::write, but also has preconditions checked by pre.

You should also read the Safety section on the documentation of std::ptr::write.

This function has preconditions

This function has the following preconditions generated by pre attributes:

  • the pointer dst must be valid for writes
  • the pointer dst must have a proper alignment for its type

To call the function you need to assure that the preconditions hold:

#[assure(
    valid_ptr(dst, w),
    reason = "<specify the reason why you can assure this here>"
)]
#[assure(
    proper_align(dst),
    reason = "<specify the reason why you can assure this here>"
)]
write(/* parameters omitted */);