Module cycler::traits[][src]

These are traits that are implemented for the types of cyclers. CyclerWriter has many sub-traits that contain the functions allowing the writer to move to the next block, while CyclerReader is a single trait that allows the reader to move to the latest block. WriteAccess and ReadAccess are traits that should be implemented for any type that goes into a cycler.

Traits

CyclerReader

This trait is implemented for the read half of a cycler.

CyclerWriter

This trait is implemented for the write half of a cycler.

CyclerWriterDefault

This trait enables the write half of the cycler to be moved to the next chunk by a default copy function. Usually this function is Clone::clone_from but that is not a strict requirement.

CyclerWriterFn

This trait enables the write half of the cycler to move to the next block using a given clone function. This function follows the signature of Clone::clone_from, meaning the arguments are (to, from).

CyclerWriterMutFn

This trait enables the write half of the cycler to move to the next block using a clone function that takes a mutable reference to the previous block. This is not preferable as optimizations where the reader can read the previous block while it’s being cloned are not possible. The function arguments are (from, to)

EnsureSend

Trait that can be implemented to ensure a type is send

EnsureSync

Trait that can be implemented to ensure a type is sync

ReadAccess

This trait should be implemented for any type that can be read from by a cycler. This specifically allows for the separation of read and write data from the cycler readers and writers. If this functionality is not needed then ReadAccess::Read can be set to Self for no runtime cost.

UniversalCyclerReader

This trait is a collection of all the primarily supported reader traits. Other traits may be added to this in the future but none will be taken away without a major version bump. Other traits may also be added that do not fall under this for more specific functionality.

UniversalCyclerWriter

This trait is a collection of all the primarily supported writer traits. Other traits may be added to this in the future but none will be taken away without a major version bump. Other traits may also be added that do not fall under this for more specific functionality (ex: CyclerWriterMutFn).

WriteAccess

This trait should be implemented for any type that can be written to by a cycler. This specifically allows for the separation of read and write data from the cycler readers and writers. If this functionality is not needed then WriteAccess::Write can be set to Self for no runtime cost.