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§
Provided Methods§
Sourcefn requires(&self) -> &'static [(&'static str, &'static str)]
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.
Sourcefn names_api_runtime(&self) -> bool
fn names_api_runtime(&self) -> bool
Whether its additions name the API runtime crate (e.g.
SortDirectionDto), which a mirror then names by default.
Sourcefn sort_direction(&self, _context: &Context<'_>) -> Option<TokenStream>
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.
Sourcefn page(&self, _context: &Context<'_>) -> Option<TokenStream>
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.
Sourcefn sort_field(&self, _context: &Context<'_>) -> TypeAdditions
fn sort_field(&self, _context: &Context<'_>) -> TypeAdditions
Its additions to the sort field enum.
Sourcefn sort_details(&self, _context: &Context<'_>) -> TypeAdditions
fn sort_details(&self, _context: &Context<'_>) -> TypeAdditions
Its additions to the sort details struct.
Sourcefn query_params(&self, _context: &Context<'_>) -> TypeAdditions
fn query_params(&self, _context: &Context<'_>) -> TypeAdditions
Its additions to the query parameters struct.
Sourcefn page_size(&self, _context: &Context<'_>) -> TokenStream
fn page_size(&self, _context: &Context<'_>) -> TokenStream
Its attributes on the page_size query parameter.
Sourcefn sort(&self, _context: &Context<'_>) -> TokenStream
fn sort(&self, _context: &Context<'_>) -> TokenStream
Its attributes on the sort query parameter (of a sortable mirror).
Sourcefn items(&self, _context: &Context<'_>) -> TokenStream
fn items(&self, _context: &Context<'_>) -> TokenStream
Its items of any mirror (e.g. trait impls on the generated types).
Sourcefn sortable_items(&self, _context: &Context<'_>) -> TokenStream
fn sortable_items(&self, _context: &Context<'_>) -> TokenStream
Its items of a sortable mirror (e.g. a validator of the sort details).
Sourcefn supports_validate_non_nullable(&self) -> bool
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.
Sourcefn validate_non_nullable(
&self,
_context: &NonNullableContext<'_>,
) -> TokenStream
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".