[][src]Trait lv2_atom::scalar::ScalarAtom

pub trait ScalarAtom: UriBound {
    type InternalType: Unpin + Copy + Send + Sync + Sized + 'static;
    fn read_scalar(body: Space<'_>) -> Option<Self::InternalType> { ... }
fn write_scalar<'a, 'b>(
        frame: FramedMutSpace<'a, 'b>,
        value: Self::InternalType
    ) -> Option<&'a mut Self::InternalType> { ... } }

An atom that only contains a single, scalar value.

Since scalar values are so simple, the reading and writing methods are exactly the same.

Associated Types

type InternalType: Unpin + Copy + Send + Sync + Sized + 'static

The internal representation of the atom.

For example, the Int atom has the internal type of i32, which is i32 on most platforms.

Loading content...

Provided methods

fn read_scalar(body: Space<'_>) -> Option<Self::InternalType>

Try to read the atom from a space.

If the space does not contain the atom or is not big enough, return None. The second return value is the space behind the atom.

fn write_scalar<'a, 'b>(
    frame: FramedMutSpace<'a, 'b>,
    value: Self::InternalType
) -> Option<&'a mut Self::InternalType>

Try to write the atom into a space.

Write an atom with the value of value into the space and return a mutable reference to the written value. If the space is not big enough, return None.

Loading content...

Implementors

impl ScalarAtom for AtomURID[src]

impl ScalarAtom for Bool[src]

impl ScalarAtom for Double[src]

impl ScalarAtom for Float[src]

impl ScalarAtom for Int[src]

impl ScalarAtom for Long[src]

Loading content...