Module cognitive_qualia::memory [] [src]

This module provides buffer memory management tools.

Clients usually share images with server using shared memory. Client creates big shared memory and then tells server which parts server should use for drawing on surfaces. Memory represents this shared memory (and is owner of data) and MemoryView can be used to view parts of it.

Images to redraw can be also created locally or read from file. These images can be stored in Buffer. Buffer and MemoryView implement Pixmap trait, but Buffer is owned of its data unlike MemoryView.

MemoryPool is used to provide mechanism for storing mapped and buffered memory. The only way to construct MemoryView is through MemoryPool. Both have counted reference to Memory and the Memory is destructed when its reference count goes to zero, so MemoryViews can be safely used even after Memory was removed from MemoryPool.

Structs

Buffer

Container for all data required to draw an image.

Memory

Represents memory shared with client.

MemoryPool

This structure is used to provide storage for images of different type: shared memory and buffers and return views to them.

MemoryView

Represents view into memory shared with client.