Module prelude

Module prelude 

Source

Macros§

Product
The Product! macro is used to define a type-level list of types, a.k.a. a product type.
Sum
The Sum! macro is used to define a sum type, with the given list of types as disjoint variants.
Symbol
The Symbol! macro is used to create a type-level string through the string literal given to the macro.
cgp_preset
CGP presets are made of extensible collection of key/value mappings, that can be inherited to form new mappings.
check_components
The check_components! macro allows users to write compile-time tests to check for the correctness of component wiring for a CGP context.
delegate_and_check_components
The delegate_and_check_components! macro combines both delegate_components! and check_components!, allowing both delegation and checks within a single macro call.
delegate_components
The delegate_components! macro is used to define wiring of CGP components on a provider type.
product
replace_with

Structs§

Chars
The Chars type, a.k.a. ζ, is used to represent type-level list of Charss, which are equivalent to type-level strings.
Cons
The Cons type, a.k.a. π, is used to represent the head of a type-level list, also known as an anonymous product type.
Field
The Field type, a.k.a. ω, is used to represent a named field entry within a product type or a sum type.
Index
The Index type, a.k.a. δ, is used to represent a usize value at the type level.
IsMut
IsNothing
IsPresent
IsRef
IsVoid
Life
Nil
The Nil type, a.k.a. ε, is used to represent the end of a type-level list, or an empty type-level list.
PhantomData
Zero-sized type used to mark things that “act like” they own a T.
Symbol
UseContext
The UseContext pattern is used to define a trivial implementation of a provider trait, by forwarding the implementation to the consumer trait implementation of the context.
UseDelegate
The UseDelegate pattern is used as the default dispatcher for CGP components that contain additional generic parameters in their traits.
UseField
The UseField pattern is used to implement a CGP getter trait by reading the Tag field from Context via the HasField trait.
UseFields
UseType
The UseType pattern is used to implement a CGP abstract type with the specified Type.
WithProvider
δ
The Index type, a.k.a. δ, is used to represent a usize value at the type level.
ε
The Nil type, a.k.a. ε, is used to represent the end of a type-level list, or an empty type-level list.
ζ
The Chars type, a.k.a. ζ, is used to represent type-level list of Charss, which are equivalent to type-level strings.
π
The Cons type, a.k.a. π, is used to represent the head of a type-level list, also known as an anonymous product type.
ψ
ω
The Field type, a.k.a. ω, is used to represent a named field entry within a product type or a sum type.

Enums§

Either
The Either type, a.k.a. σ, is used to represent an anonymous sum type.
Void
The Void type, a.k.a. θ, is used to represent the end of an anonymous sum type, or an empty sum type.
θ
The Void type, a.k.a. θ, is used to represent the end of an anonymous sum type, or an empty sum type.
σ
The Either type, a.k.a. σ, is used to represent an anonymous sum type.

Traits§

BuildField
CanRaiseError
The CanRaiseError trait is used to raise any concrete error type into an abstract error provided by HasErrorType.
CanUseComponent
This is a convenient type alias that is used in the same way as IsProviderFor, but with the Self type being the Context type rather than the Provider type that implements the provider trait.
CanWrapError
DelegateComponent
This is the core trait used by the delegate_component! macro to define a mapping from Name to Delegate on the target Self type.
ExtractField
FieldGetter
FinalizeBuild
FinalizeExtract
FromFields
FromVariant
HasBuilder
HasErrorType
The HasErrorType trait provides an abstract error type that can be used by CGP components to decouple the code from any concrete error implementation.
HasExtractor
HasExtractorMut
HasExtractorRef
HasField
The HasField trait is used to implement getter methods for a type that derives the trait.
HasFieldMut
HasFields
HasFieldsRef
HasType
IntoBuilder
IsProviderFor
The IsProviderFor trait is used to propagate the constraints required to implement the provider trait that corresponds to the Component type.
MapType
MapTypeRef
MutFieldGetter
PartialData
ProvideType
ToFields
ToFieldsRef
UpdateField

Type Aliases§

WithContext

Attribute Macros§

async_trait
The #[async_trait] macro is used to desugar async functions in traits to return impl Future.
cgp_auto_getter
#[cgp_auto_getter] is used on a regular getter Rust trait without turnning it into a CGP component. Instead, a blanket implementation is derived directly on that trait.
cgp_component
#[cgp_component] is the most basic macro used to define a CGP component.
cgp_context
The #[cgp_context] macro is used when defining a CGP context.
cgp_getter
#[cgp_getter] is an extension to #[cgp_component] that derives additional getter constructs.
cgp_impl
#[cgp_impl] provides a simplified ergonomic implementing a provider trait, by making it look like we are writing blanket implementations on a generic context.
cgp_inherit
cgp_new_provider
The #[cgp_new_provider] macro is an extension to #[cgp_provider] that in addition to the derivation of IsProviderFor, also generates a new provider struct based on the Self type.
cgp_provider
#[cgp_provider] is used for implementing a provider trait.
cgp_type
#[cgp_type] is an extension to #[cgp_component] that derives additional constructs for abstract type components.
re_export_imports

Derive Macros§

BuildField
CgpData
CgpRecord
CgpVariant
ExtractField
FromVariant
HasField
HasFields