#[non_exhaustive]pub struct ReservationFullParts {
pub base: *mut u8,
pub len: usize,
pub reservation: *mut u8,
pub reservation_len: usize,
pub align: usize,
pub granted_huge: bool,
}Expand description
The full components returned by Reservation::into_full_parts.
This struct contains ALL six fields needed to reconstruct a Reservation
via Reservation::from_raw_parts, eliminating the risk of metadata loss
during round-trip. Unlike ReservationParts, it preserves base, len,
and granted_huge in addition to the underlying reservation metadata.
This is the lossless round-trip alternative to ReservationParts. Use it
when you need to temporarily extract all reservation state for later
reconstruction.
This struct holds the ONLY information that can free the underlying OS
reservation (task #1213/L3) — it has no Drop impl (see the
“IMPORTANT” note on Reservation::into_full_parts for the full
explanation), so a plain drop of a ReservationFullParts — letting it
go out of scope without ever calling
into_reservation (and then dropping the
resulting Reservation) or manually releasing via
release — silently leaks the mapping.
#[must_use] here catches an ACCIDENTALLY discarded ownership token
(e.g. a call to
Reservation::into_full_parts
whose result is never bound to anything) at compile time; it does not
and cannot prevent a DELIBERATE leak (e.g. binding the result to _ or
storing it and then dropping it later without acting on it).
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.base: *mut u8The aligned usable start pointer (from Reservation::as_ptr).
len: usizeThe usable span size in bytes (from Reservation::len).
reservation: *mut u8The underlying OS reservation start (from Reservation::reservation_ptr).
reservation_len: usizeThe length of the reservation in bytes (from Reservation::reservation_len).
align: usizeThe alignment requested at reservation time.
granted_huge: boolWhether the OS granted huge pages for this reservation (from Reservation::is_huge).
Implementations§
Source§impl ReservationFullParts
impl ReservationFullParts
Sourcepub const fn new(
base: *mut u8,
len: usize,
reservation: *mut u8,
reservation_len: usize,
align: usize,
granted_huge: bool,
) -> Self
pub const fn new( base: *mut u8, len: usize, reservation: *mut u8, reservation_len: usize, align: usize, granted_huge: bool, ) -> Self
Construct a ReservationFullParts from its component fields.
This is the inverse of Reservation::into_full_parts. All six fields
are required to reconstruct a complete Reservation with no metadata loss.
No message-less #[must_use] on this function itself (task
#1213/L3): it returns Self, and the type now carries its own
#[must_use] with a leak-specific message — see
ReservationParts::new
for the identical reasoning.
Sourcepub unsafe fn into_reservation(self) -> Reservation
pub unsafe fn into_reservation(self) -> Reservation
Reconstruct a Reservation from these parts.
This is a convenience wrapper around Reservation::from_raw_parts
that forwards all six fields. The same safety requirements apply.
§Safety
All six fields must satisfy the same invariants as documented for
Reservation::from_raw_parts. See that function’s # Safety section
for full details.