Skip to main content

release_parts

Function release_parts 

Source
pub unsafe fn release_parts(parts: ReservationParts)
Expand description

Release a reservation obtained from Reservation::into_reservation_parts.

This is the typed alternative to release: it takes a ReservationParts struct instead of raw parameters, preventing accidental swapping of len and align (which would cause undefined behavior on the native backend and leaks or crashes on Unix).

For backwards compatibility with code that uses the raw tuple form, you can convert a ReservationParts to a tuple via ReservationParts::as_tuple and call release.

ยงSafety

parts.ptr must be a reservation obtained from Reservation::into_reservation_parts (or the raw Reservation::into_parts) and must be live. The reservation must be released exactly once.