Struct scoped_arena::ScopeProxy[][src]

pub struct ScopeProxy<'scope, A: Allocator = Global> { /* fields omitted */ }
Expand description

Proxy for Scope which allocates memory bound to the scope lifetime and not itself. This allows to create sub-scopes while keeping references to scoped values. Does not frees memory and does not drops values moved on scope when dropped. Parent Scope will do this.

Implementations

Allocates a block of memory. Returns a NonNull<u8> meeting the size and alignment guarantees of layout. The returned block contents should be considered uninitialized.

Returned block will be deallocated when scope is dropped.

Attempts to allocate a block of memory. On success, returns a NonNull<u8> meeting the size and alignment guarantees of layout. The returned block contents should be considered uninitialized.

Returned block will be deallocated when scope is dropped.

Errors

Returning Err indicates that memory is exhausted.

Move value onto the scope. Returns mutable reference to value with lifetime equal to ’scope lifetime. Value on scope will be dropped when scope is dropped.

This method is as cheap as allocation if value does not needs dropping as reported by core::mem::needs_drop.

Places value returned from function onto the scope. Returns mutable reference to value with lifetime equal to scope borrow lifetime. Value on scope will be dropped when scope is dropped.

This method is as cheap as allocation if value does not needs dropping as reported by core::mem::needs_drop.

Tries to move value onto the scope. On success, returns mutable reference to value with lifetime to equal ’scope lifetime. Value on scope will be dropped when scope is dropped.

This method is as cheap as allocation if value does not needs dropping as reported by core::mem::needs_drop.

Errors

Returning Err indicates that memory is exhausted. Returning Err contains original value.

Tries to place value return from function onto the scope. On success, returns mutable reference to value with lifetime equal to scope borrow lifetime. Value on scope will be dropped when scope is dropped.

This method is as cheap as allocation if value does not needs dropping as reported by core::mem::needs_drop.

Errors

Returning Err indicates that memory is exhausted. Returning Err contains original value.

Move values from iterator onto the scope. Returns mutable reference to slice with lifetime equal to ’scope lifetime. Values on scope will be dropped when scope is dropped.

This method is as cheap as allocation if value does not needs dropping as reported by core::mem::needs_drop.

This method allocates memory to hold iterator’s upper bound number of items. See core::iter::Iterator::size_hint. It will not consume more items. This method will always fail for unbound iterators.

Tries to move values from iterator onto the scope. On success, returns mutable reference to slice with lifetime equal to ’scope lifetime. Values on scope will be dropped when scope is dropped.

This method is as cheap as allocation if value does not needs dropping as reported by core::mem::needs_drop.

This method allocates memory to hold iterator’s upper bound number of items. See core::iter::Iterator::size_hint. It will not consume more items. This method will always fail for unbound iterators.

Errors

Returning Err indicates that memory is exhausted. Returning Err contains original iterator.

Reports total memory allocated from underlying allocator by associated arena.

Creates new scope which inherits from the proxy’s scope. This scope becomes locked until returned scope is dropped. Returned scope will use reference to the underlying allocator.

Creates new scope which inherits from the proxy’s scope. This scope becomes locked until returned scope is dropped. Returned scope will use clone of the underlying allocator.

Trait Implementations

Formats the value using the given formatter. Read more

Executes the destructor for this type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.