Skip to main content

Crate cgp_macro

Crate cgp_macro 

Source
Expand description

This crate provides the proc macros used for defining CGP components.

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

Attribute Macros§

blanket_trait
The #[blanket_trait] macro can be used to define trait aliases that contain empty body and trivial blanket implementations.
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_fn
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
The macro also allows the context provider to inherit its component mappings from a specified preset.
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