Skip to main content

Reservation

Struct Reservation 

Source
pub struct Reservation { /* private fields */ }
Expand description

Memory one operator is holding, given back when this is dropped.

It starts at whatever Memory::reserve was asked for and grows from there, which is the shape a buffering operator wants: it does not know how much it will hold until it has read its input, and it wants to be told as soon as the answer is too much rather than after the last row.

Implementations§

Source§

impl Reservation

Source

pub fn bytes(&self) -> u64

How much this reservation is holding.

Source

pub fn grow(&mut self, bytes: u64) -> Result<()>

Takes another bytes out of the same budget.

§Errors

crate::ErrorCode::OutOfMemory when the limit is set and this would pass it. The reservation is unchanged in that case and still releases what it already held.

Source

pub fn release(&mut self)

Gives everything back now rather than at the end of the scope.

For an operator that has finished with its buffer and is about to hand out what it built from it, where waiting for the drop would hold two copies against the limit at once.

Trait Implementations§

Source§

impl Debug for Reservation

Source§

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

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

impl Drop for Reservation

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.