API reference Dodo 0.1.4

std/bytes_alloc

Public declarations, types, methods, and source contracts for std/bytes_alloc.

On this page

Library guide · API index and notation

This page is generated from the bundled library in this checkout. Signatures and adjacent source comments are reproduced below; the linked guide explains usage, storage, failures, and platform support.

import "std/bytes_alloc"

Names used in signatures

Unqualified names denote this package’s types (including other source files in the same package), language built-ins, or generic parameters such as T. Qualified names use the import aliases below. These aliases belong to the library source; import a dependency yourself to use its alias in your program.

Alias Package Source file
block alloc/block bytes_alloc.dodo
error alloc/error bytes_alloc.dodo
layout alloc/layout bytes_alloc.dodo
mem core/mem bytes_alloc.dodo
ptr core/ptr bytes_alloc.dodo

Buffer

Struct · Source

Move-only growing byte storage. The allocator remains exclusively borrowed. Every growth temporarily requires both old and new allocations to be live.

pub struct Buffer<A> {
    // Private implementation fields omitted.
}

Buffer.len

Function · Source

pub fn len(&self) -> usize

Buffer.capacity

Function · Source

pub fn capacity(&self) -> usize

Buffer.limit

Function · Source

pub fn limit(&self) -> usize

Buffer.as_slice

Function · Source

pub fn as_slice(&self) -> &[u8]from(self)

Buffer.as_mut_slice

Function · Source

pub fn as_mut_slice(&mut self) -> &mut[u8]from(self)

Buffer.truncate

Function · Source

pub fn truncate(&mut self, length: usize)

Buffer.clear

Function · Source

pub fn clear(&mut self)

Buffer.reserve

Function · Source

Reserve space for additional bytes beyond len. Errors preserve all data.

pub fn reserve(&mut self, additional: usize) -> void!error.AllocError

Buffer.extend

Function · Source

pub fn extend(&mut self, bytes: &[u8]) -> void!error.AllocError

Buffer.push

Function · Source

pub fn push(&mut self, byte: u8) -> void!error.AllocError

new

Function · Source

SAFETY: A.allocate returns exclusive, writable, correctly aligned storage of the requested layout, valid until A.deallocate. Deallocation accepts exactly the originating live descriptor, cannot fail, and does not unwind. Zero-size descriptors must also be supported. No global allocator or hidden fallback.

pub unsafe fn new<A>(allocator: &mut A, capacity: usize, limit: usize) -> Buffer<A>!error.AllocError from(allocator)

Requires an unsafe context. Follow the source safety preconditions and the linked guide before calling this API.

Type to search all documentation.

Keyboard shortcuts

Search documentation
Ctrl K or /
Move through results
↑ ↓
Open selected result
Enter
Close a dialog
Esc
Show these shortcuts
?