compris 0.0.11

Composite Primitive Schema (CPS) for Rust
Documentation
/// Cast to a [Variant](super::super::Variant) with
/// [Annotations](super::super::super::annotate::Annotations).
#[macro_export]
macro_rules! with_annotations {
    () => ( $crate::normal::Variant::Nothing<$crate::annotate::WithAnnotations> );

    ( $value:expr $(,)? ) => ( ($value) as $crate::normal::Variant<$crate::annotate::WithAnnotations> );
}

/// Cast to a [Variant](super::super::Variant) without
/// [Annotations](super::super::super::annotate::Annotations).
#[macro_export]
macro_rules! without_annotations {
    () => ( $crate::normal::Variant::Nothing<$crate::annotate::WithoutAnnotations> );

    ( $value:expr $(,)? ) => ( ($value) as $crate::normal::Variant<$crate::annotate::WithoutAnnotations> );
}

/// Creates a [Variant](super::super::Variant) from a bare primitive expression.
#[macro_export]
macro_rules! normal {
    () => {
        $crate::normal::Variant::Nothing
    };

    ( $value:expr $(,)? ) => {
        $crate::normal::Variant::from($value)
    };
}

/// Creates a [Variant::List](super::super::Variant::List) from a sequence of bare primitive expressions.
#[macro_export]
macro_rules! normal_list {
    () => (
        $crate::normal::Variant::List(
            $crate::normal::List::default()
        )
    );

    ( $( $value:expr ),+ $(,)? ) => (
        $crate::normal::Variant::List(
            $crate::normal::List::from(
                vec![ $( $crate::normal!( $value ) ),+ ]
            )
        )
    );
}

/// Creates a [Variant::Map](super::super::Variant::Map) from a sequence of key-value tuples.
#[macro_export]
macro_rules! normal_map {
    () => (
        $crate::normal::Variant::Map(
            $crate::normal::Map::default()
        )
    );

    ( $( ( $key:expr, $value:expr ) ),+ $(,)? ) => (
        $crate::normal::Variant::Map(
            $crate::normal::Map::from(
                [ $( ( $crate::normal!( $key ), $crate::normal!( $value ) ) ),+ ]
            )
        )
    );
}

/// Creates a [Vec]<[Variant](super::super::Variant)> from a sequence of bare primitive expressions.
#[macro_export]
macro_rules! normal_vec {
    ( $( $value:expr ),* $(,)? ) => (
        vec![ $( $crate::normal!( $value ) ),* ]
    );
}

#[allow(unused_imports)]
pub use {normal, normal_list, normal_map, normal_vec, with_annotations, without_annotations};