ferment-sys 0.2.14

Syntax tree morphing of FFI-compatible stuff
Documentation
pub(crate) mod r#abstract;
mod any_other;
mod array;
mod attrs;
mod bare_fn;
mod basic;
mod bounds;
mod callback;
mod constants;
mod conversion_drop;
mod conversion_from;
mod conversion_to;
mod doc;
mod r#enum;
mod enum_variant;
mod ffi_bindings;
mod ffi_conversions;
mod generic;
mod generics;
mod group;
mod r#impl;
mod impl_fn;
mod item;
mod item_wrapper;
mod lifetimes;
mod map;
mod method;
mod mod_fn;
mod opaque_struct;
mod pat_type;
mod result;
mod signature;
mod signature_wrapper;
mod slice;
mod smart_pointer;
mod r#struct;
mod target_var;
mod r#trait;
mod trait_as_type;
mod trait_fn;
mod trait_inner_fn;
mod tuple;
mod r#type;
mod type_alias;
mod var;
mod vtable;

use std::rc::Rc;
use syn::__private::TokenStream2;
use syn::{Field, Type};
use syn::punctuated::Punctuated;
use syn::token::{Comma, Semi};
use crate::ast::{CommaPunctuated, SemiPunctuated};
use crate::composable::{FieldComposer, NestedArgument};
use crate::composer::r#abstract::{SequenceComposer, SequenceMixer};
use crate::ext::Conversion;
use crate::lang::Specification;
use crate::presentable::{Aspect, BindingPresentableContext, ArgKind, SeqKind};
use crate::presentation::ArgPresentation;
use crate::shared::SharedAccess;

pub use self::r#abstract::*;
pub use self::any_other::*;
#[allow(unused)]
pub use self::array::*;
pub use self::attrs::*;
pub use self::basic::*;
pub use self::bare_fn::*;
pub use self::bounds::*;
pub use self::callback::*;
pub use self::constants::*;
pub use self::conversion_drop::*;
pub use self::doc::*;
pub use self::r#enum::*;
pub use self::enum_variant::*;
pub use self::ffi_bindings::*;
pub use self::ffi_conversions::*;
pub use self::conversion_from::*;
pub use self::generic::*;
pub use self::generics::*;
pub use self::group::*;
pub use self::r#impl::*;
pub use self::impl_fn::*;
pub use self::item::*;
pub use self::item_wrapper::*;
pub use self::lifetimes::*;
pub use self::map::*;
pub use self::method::*;
pub use self::mod_fn::*;
pub use self::opaque_struct::*;
pub use self::result::*;
pub use self::signature::*;
pub use self::slice::*;
pub use self::smart_pointer::*;
pub use self::r#struct::*;
#[allow(unused)]
pub use self::target_var::*;
pub use self::conversion_to::*;
pub use self::r#trait::*;
pub use self::trait_as_type::*;
pub use self::trait_fn::*;
pub use self::trait_inner_fn::*;
pub use self::tuple::*;
pub use self::r#type::TypeComposer;
pub use self::type_alias::*;
pub use self::var::*;
pub use self::vtable::*;

/// Composer Context Presenters
pub type ComposerLink<T> = Rc<std::cell::RefCell<T>>;
pub type ComposerLinkRef<'a, T> = std::cell::Ref<'a, T>;
pub type Composer<T, U> = fn(context: T) -> U;
pub type ComposerByRef<T, U> = fn(context: &T) -> U;
pub type SourceComposerByRef<S, T, U> = fn(source: &S, context: T) -> U;
pub type SourceContextComposerByRef<S, C, M, U> = fn(source: &S, composer: ComposerByRef<C, M>) -> U;
pub type SharedComposer<Link, U> = ComposerByRef<<Link as SharedAccess>::ImmutableAccess, U>;
pub type FieldComposerProducer<SPEC> = SourceComposerByRef<Field, usize, FieldComposer<SPEC>>;
pub type AspectArgSourceComposer<SPEC, Iter> = SourceComposerByRef<AspectArgComposers<SPEC>, ArgProducerByRef<SPEC, <Iter as IntoIterator>::Item>, OwnerAspectSequence<SPEC, Iter>>;
pub type SharedAspectArgComposer<SPEC, Link> = SharedComposer<Link, AspectArgComposers<SPEC>>;
pub type SharedComposerLink<C, U> = SharedComposer<ComposerLink<C>, U>;
pub type ItemComposerLink<SPEC, I> = ComposerLink<ItemComposer<SPEC, I>>;
pub type EnumVariantComposerLink<SPEC, I> = ComposerLink<EnumVariantComposer<SPEC, I>>;
pub type StructComposerLink<SPEC, I> = ComposerLink<StructComposer<SPEC, I>>;
pub type OpaqueStructComposerLink<SPEC, I> = ComposerLink<OpaqueStructComposer<SPEC, I>>;
pub type TypeAliasComposerLink<SPEC, I> = ComposerLink<TypeAliasComposer<SPEC, I>>;
pub type EnumComposerLink<SPEC> = ComposerLink<EnumComposer<SPEC>>;
pub type SigComposerLink<SPEC> = ComposerLink<SigComposer<SPEC>>;
pub type VTableComposerLink<SPEC> = ComposerLink<VTableComposer<SPEC>>;
pub type ImplComposerLink<SPEC> = ComposerLink<ImplComposer<SPEC>>;
pub type TraitComposerLink<SPEC> = ComposerLink<TraitComposer<SPEC>>;
pub type BiLinkedContextComposer<L, T> = LinkedContextComposer<L, T, T>;
pub type SeqKindComposer<SPEC, L> = BiLinkedContextComposer<L, SeqKind<SPEC>>;
pub type MaybeSequenceOutputComposer<SPEC, L> = Option<SeqKindComposer<SPEC, L>>;
pub type MaybeSequenceOutputComposerLink<SPEC, T> = Option<SeqKindComposer<SPEC, ComposerLink<T>>>;
pub type SeqKindComposerLink<SPEC, T> = SeqKindComposer<SPEC, ComposerLink<T>>;
pub type VariantComposerRef<SPEC> = ComposerByRef<AspectCommaPunctuatedArgKinds<SPEC>, SeqKind<SPEC>>;
pub type PresentableArgKindPairComposerRef<SPEC> = ArgProducerByRef<SPEC, ArgKindPair<SPEC>>;
pub type FieldsComposerRef<SPEC> = ComposerByRef<CommaPunctuatedFields, CommaArgComposers<SPEC>>;
pub type PresentableExprComposerRef<SPEC> = ComposerByRef<FieldTypeLocalContext<SPEC>, <SPEC as Specification>::Expr>;
pub type PresentableArgKindComposerRef<SPEC> = ArgProducerByRef<SPEC, ArgKind<SPEC>>;
#[allow(unused)]
pub type OwnedFieldsIterator<SPEC> =
    IterativeComposer<
        OwnedArgComposers<SPEC, OwnerAspect<SPEC>>,
        FieldComposer<SPEC>,
        ArgKind<SPEC>,
        OwnerAspectSequence<SPEC, CommaPunctuatedArgKinds<SPEC>>>;
pub type BindingComposer<SPEC, T> = Composer<T, BindingPresentableContext<SPEC>>;
pub type PunctuatedArgKinds<SPEC, SEP> = Punctuated<ArgKind<SPEC>, SEP>;
pub type SignatureAspect<SPEC> = (<SPEC as Specification>::Attr, <SPEC as Specification>::Lt, <SPEC as Specification>::Gen);
pub type OwnerAspect<SPEC> = (Aspect<<SPEC as Specification>::TYC>, SignatureAspect<SPEC>, NameKind);
pub type OwnerAspectSequence<SPEC, T> = (OwnerAspect<SPEC>, T);
pub type OwnerAspectSequenceComposer<SPEC, T, U> = Composer<OwnerAspectSequence<SPEC, T>, U>;
pub type PresentableArgsSequenceComposer<SPEC> = OwnerAspectSequenceComposer<SPEC, CommaPunctuatedArgKinds<SPEC>, SeqKind<SPEC>>;
pub type OwnedArgComposers<SPEC, T> = (T, CommaArgComposers<SPEC>);
pub type AspectPresentableArgKinds<SPEC, SEP> = OwnerAspectSequence<SPEC, PunctuatedArgKinds<SPEC, SEP>>;
pub type AspectArgComposers<SPEC> = OwnerAspectSequence<SPEC, CommaArgComposers<SPEC>>;
pub type AspectCommaPunctuatedArgKinds<SPEC> = AspectPresentableArgKinds<SPEC, Comma>;
pub type AspectTerminatedArgKinds<SPEC> = AspectPresentableArgKinds<SPEC, Semi>;
pub type ArgComposers<SPEC, SEP> = Punctuated<FieldComposer<SPEC>, SEP>;
pub type CommaArgComposers<SPEC> = ArgComposers<SPEC, Comma>;

pub type BindingAccessorContext<SPEC> = (
    Aspect<<SPEC as Specification>::TYC>,
    SignatureAspect<SPEC>,
    VarComposer<SPEC>,
    TokenStream2,
);
pub type FieldTypeLocalContext<SPEC> = (<SPEC as Specification>::Name, Conversion<SPEC>);
pub type ArgKindPair<SPEC> = (ArgKind<SPEC>, ArgKind<SPEC>);
pub type TypePair = (Type, Type);
pub type ArgKindPairs<SPEC> = Vec<ArgKindPair<SPEC>>;
pub type CommaPunctuatedArgs = CommaPunctuated<ArgPresentation>;
pub type SemiPunctuatedArgs = SemiPunctuated<ArgPresentation>;
pub type CommaPunctuatedArgKinds<SPEC> = PunctuatedArgKinds<SPEC, Comma>;
pub type SemiPunctuatedArgKinds<SPEC> = PunctuatedArgKinds<SPEC, Semi>;
pub type CommaPunctuatedFields = CommaPunctuated<Field>;
pub type CommaPunctuatedNestedArguments = CommaPunctuated<NestedArgument>;
pub type ArgProducerByRef<SPEC, OUT> = ComposerByRef<FieldComposer<SPEC>, OUT>;
pub type FieldPathResolver<SPEC> = ArgProducerByRef<SPEC, FieldTypeLocalContext<SPEC>>;
pub type AspectSeqKindComposer<SPEC, SEP> = Composer<AspectPresentableArgKinds<SPEC, SEP>, SeqKind<SPEC>>;
pub type ConversionSeqKindComposer<SPEC> = AspectSeqKindComposer<SPEC, Comma>;
pub type DropSeqKindComposer<SPEC> = AspectSeqKindComposer<SPEC, Semi>;
pub type ArgKindProducerByRef<SPEC> = ArgProducerByRef<SPEC, ArgKind<SPEC>>;
pub type FieldsSequenceMixer<SPEC, Link, Context, Statement> = SequenceMixer<
    Link,
    Context,
    FieldTypeLocalContext<SPEC>,
    <SPEC as Specification>::Expr,
    Statement,
    SeqKind<SPEC>,
    SeqKind<SPEC>,
    SeqKind<SPEC>
>;
pub type FFIConversionsMixer<SPEC, Link> = InterfaceSequenceMixer<SPEC, Link, Comma>;
pub type DropSequenceMixer<SPEC, Link> = InterfaceSequenceMixer<SPEC, Link, Semi>;

pub type InterfaceSequenceMixer<SPEC, Link, SEP> = FieldsSequenceMixer<
    SPEC,
    Link,
    AspectArgComposers<SPEC>,
    AspectPresentableArgKinds<SPEC, SEP>,
>;
pub type ArgsSequenceComposer<SPEC, Link, A, B, C, Presentable> = SequenceComposer<
    Link,
    A,
    FieldComposer<SPEC>,
    B,
    C,
    Presentable
>;
pub type OwnerAspectSequenceSpecComposer<SPEC, Link, Iter, Out> = ArgsSequenceComposer<
    SPEC,
    Link,
    AspectArgComposers<SPEC>,
    <Iter as IntoIterator>::Item,
    OwnerAspectSequence<SPEC, Iter>,
    Out
>;
pub type FieldsOwnedSequenceComposer<SPEC, Link> = ArgsSequenceComposer<
    SPEC,
    Link,
    AspectArgComposers<SPEC>,
    ArgKind<SPEC>,
    AspectCommaPunctuatedArgKinds<SPEC>,
    SeqKind<SPEC>,
>;
pub type CtorSequenceComposer<SPEC, Link, Iter> = ArgsSequenceComposer<
    SPEC,
    Link,
    AspectArgComposers<SPEC>,
    ArgKindPair<SPEC>,
    OwnerAspectSequence<SPEC, Iter>,
    BindingPresentableContext<SPEC>,
>;
pub type InterfaceMethodSequenceComposer<SPEC, Link, SEP> = SequenceComposer<
    Link,
    AspectArgComposers<SPEC>,
    FieldTypeLocalContext<SPEC>,
    <SPEC as Specification>::Expr,
    AspectPresentableArgKinds<SPEC, SEP>,
    SeqKind<SPEC>,
>;
pub type FieldsOwnedSequenceComposerLink<SPEC, T> = FieldsOwnedSequenceComposer<SPEC, ComposerLink<T>>;
pub type AspectSharedComposerLink<SPEC, T> = SharedComposerLink<T, AspectArgComposers<SPEC>>;
pub type SequenceSharedComposerLink<SPEC, T> = SharedComposerLink<T, SeqKind<SPEC>>;
pub type RootSequenceComposer<SPEC> = SourceComposerByRef<SeqKind<SPEC>, SeqKind<SPEC>, SeqKind<SPEC>>;