Skip to main content

Integration

Trait Integration 

Source
pub trait Integration: Sync {
Show 14 methods // Required method fn name(&self) -> &'static str; // Provided methods fn requires(&self) -> &'static [(&'static str, &'static str)] { ... } fn names_api_runtime(&self) -> bool { ... } fn sort_direction(&self, _context: &Context<'_>) -> Option<TokenStream> { ... } fn page(&self, _context: &Context<'_>) -> Option<TokenStream> { ... } fn sort_field(&self, _context: &Context<'_>) -> TypeAdditions { ... } fn sort_details(&self, _context: &Context<'_>) -> TypeAdditions { ... } fn query_params(&self, _context: &Context<'_>) -> TypeAdditions { ... } fn page_size(&self, _context: &Context<'_>) -> TokenStream { ... } fn sort(&self, _context: &Context<'_>) -> TokenStream { ... } fn items(&self, _context: &Context<'_>) -> TokenStream { ... } fn sortable_items(&self, _context: &Context<'_>) -> TokenStream { ... } fn supports_validate_non_nullable(&self) -> bool { ... } fn validate_non_nullable( &self, _context: &NonNullableContext<'_>, ) -> TokenStream { ... }
}
Expand description

An integration of a mirror’s generated code with another crate.

Every addition defaults to nothing, so an integration implements only what it adds. Its additions name the crates they need by absolute path or by a path from the using crate, never assuming the call site’s imports.

Required Methods§

Source

fn name(&self) -> &'static str

Its flag in #[filters(...)], e.g. serde.

Provided Methods§

Source

fn requires(&self) -> &'static [(&'static str, &'static str)]

The integrations it cannot do without, each with the reason, reported at its flag when one is missing.

Source

fn names_api_runtime(&self) -> bool

Whether its additions name the API runtime crate (e.g. SortDirectionDto), which a mirror then names by default.

Source

fn sort_direction(&self, _context: &Context<'_>) -> Option<TokenStream>

The sort direction type it needs in the sort details, if not the core SortDirectionModel. It converts both ways with SortDirectionModel, for the mirror to convert into the struct it mirrors and back. The integrations of a mirror providing one must agree on it.

Source

fn page(&self, _context: &Context<'_>) -> Option<TokenStream>

The type of a page of the mirror’s input, for the page alias. The integrations of a mirror providing one must agree on it.

Source

fn sort_field(&self, _context: &Context<'_>) -> TypeAdditions

Its additions to the sort field enum.

Source

fn sort_details(&self, _context: &Context<'_>) -> TypeAdditions

Its additions to the sort details struct.

Source

fn query_params(&self, _context: &Context<'_>) -> TypeAdditions

Its additions to the query parameters struct.

Source

fn page_size(&self, _context: &Context<'_>) -> TokenStream

Its attributes on the page_size query parameter.

Source

fn sort(&self, _context: &Context<'_>) -> TokenStream

Its attributes on the sort query parameter (of a sortable mirror).

Source

fn items(&self, _context: &Context<'_>) -> TokenStream

Its items of any mirror (e.g. trait impls on the generated types).

Source

fn sortable_items(&self, _context: &Context<'_>) -> TokenStream

Its items of a sortable mirror (e.g. a validator of the sort details).

Source

fn supports_validate_non_nullable(&self) -> bool

Whether it applies to ValidateNonNullable (a validation library), defining the DTO’s validate_non_nullable with Integration::validate_non_nullable.

Source

fn validate_non_nullable( &self, _context: &NonNullableContext<'_>, ) -> TokenStream

The DTO’s validate_non_nullable: its library’s validation of the struct, then an error for each field of rejected_nulls() (the fields set to null that may not be), in its library’s error type.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§