Struct maskerad_memory_allocators::MemoryChunk [] [src]

pub struct MemoryChunk { /* fields omitted */ }

The MemoryChunk is just a chunk of memory. It uses a RawVec to allocate bytes in a vector-like fashion.

This structure allows you allocate data of different type in the same storage, since :

  • The chunk knows the location of the first unused byte in its memory storage, and update it when allocation occurs or when objects in the memory chunk are dropped.

  • The chunk extracts, for the types implementing the Drop trait, some info about the type (its virtual table) and place it next to the object. The chunk is able to call the drop method of the object with the virtual table.

You should not use the MemoryChunk directly. The allocators manage memory chunks, use them.

Methods

impl MemoryChunk
[src]

[src]

Creates a new memory chunk, allocating the given number of bytes.

[src]

Returns the index of the first unused byte in the memory storage of the chunk.

[src]

Set the index of the first unused byte in the memory storage of the chunk.

[src]

Returns the maximal number of bytes the chunk can store.

[src]

Returns a pointer to the start of the memory storage used by the chunk.

[src]

Drop all the data contained in the chunk.

[src]

Drop the data contained in the chunk, starting from the given marker.