Crate cognitive_frames

Source
Expand description

Defines data structures and functionality used to build and manipulate space-like and time-like relations between surfaces.

§Structure

Frames are organized in tree-like structure with one root. Children of every branch have two orders:

  • time-like - describing the order of use of frames in given branch
  • space-like - describing placement order as drawn on screen

§Manipulations

Basic manipulation in the tree is to append, prepend or join frames in spatial order. Using these manipulations added frame always becomes last in time order. To become first in time order the frame must be pop-ed.

§Extensions

Extensions to basic functionality are implemented by traits first to clearly separate functionalities, secondly to make files shorter by breaking code to different modules.

  • searching - gives more advance or common ways to find specified frames
  • settle - implements common ways of adding or moving frames

§Implementation

Frame tree is cyclic graph with each node optionally pointing to:

  • parent
  • next sibling in time order
  • previous sibling in time order
  • first child in time order
  • last child in time order
  • next sibling in space order
  • previous sibling in space order
  • first child in space order
  • last child in space order

Current implementation uses unsafe raw pointers. This make implementation faster and simpler than with other more idiomatic ways, but loses Rusts guaranties. Runtime safety is ensured by unit tests.

Structs§

Frame
Frame main data structure.
FrameSpaceIterator
Iterator over frames in space order.
FrameTimeIterator
Iterator over frames in time order.
Parameters
Parameters of the frame defining its properties.

Enums§

Geometry
Defines geometry of the frame.
Mobility
Defines what spatial operations are allowed in the frame.
Mode
Defines mode of the frame.
Side
Enum used to define place relative to some frame.

Traits§

Converting
Extension trait for Frame adding more displaying functionality.
Packing
Extension trait for Frame adding more packing functionality.
Searching
Extension trait for Frame adding more search functionality.
Settling
Extension trait for Frame adding more settling functionality.