Skip to main content

ReservationFullParts

Struct ReservationFullParts 

Source
#[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
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§base: *mut u8

The aligned usable start pointer (from Reservation::as_ptr).

§len: usize

The usable span size in bytes (from Reservation::len).

§reservation: *mut u8

The underlying OS reservation start (from Reservation::reservation_ptr).

§reservation_len: usize

The length of the reservation in bytes (from Reservation::reservation_len).

§align: usize

The alignment requested at reservation time.

§granted_huge: bool

Whether the OS granted huge pages for this reservation (from Reservation::is_huge).

Implementations§

Source§

impl ReservationFullParts

Source

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.

Source

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.

Trait Implementations§

Source§

impl Debug for ReservationFullParts

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for ReservationFullParts

Source§

impl PartialEq for ReservationFullParts

Source§

fn eq(&self, other: &ReservationFullParts) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Send for ReservationFullParts

Source§

impl StructuralPartialEq for ReservationFullParts

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.