Skip to main content

queryweave_api/
features.rs

1//! Which of this crate's features are enabled, for the code generated for a
2//! mirror to check.
3//!
4//! An integration naming this crate's types (e.g. `serde`, whose mirror's
5//! sort details hold a `SortDirectionDto`) needs the feature of the same
6//! name, which derives its traits on them. Each feature has a trait here,
7//! implemented for [`SortDirectionDto`](crate::SortDirectionDto) only when
8//! the feature is enabled; a mirror opting into the integration requires it,
9//! so a disabled feature is reported at the mirror's flag, naming the feature
10//! to enable, rather than only as traits missing on `SortDirectionDto`.
11
12/// Implemented when the `serde` feature is enabled.
13#[diagnostic::on_unimplemented(
14    message = "the `serde` integration needs `queryweave-api`'s `serde` feature",
15    label = "`queryweave-api` is built without its `serde` feature",
16    note = "enable it: `queryweave-api = {{ version = \"..\", features = [\"serde\"] }}`"
17)]
18pub trait Serde {}
19
20#[cfg(feature = "serde")]
21impl Serde for crate::SortDirectionDto {}
22
23/// Implemented when the `utoipa` feature is enabled.
24#[diagnostic::on_unimplemented(
25    message = "the `utoipa` integration needs `queryweave-api`'s `utoipa` feature",
26    label = "`queryweave-api` is built without its `utoipa` feature",
27    note = "enable it: `queryweave-api = {{ version = \"..\", features = [\"utoipa\"] }}`"
28)]
29pub trait Utoipa {}
30
31#[cfg(feature = "utoipa")]
32impl Utoipa for crate::SortDirectionDto {}
33
34/// Implemented when the `schemars` feature is enabled.
35#[diagnostic::on_unimplemented(
36    message = "the `schemars` integration needs `queryweave-api`'s `schemars` feature",
37    label = "`queryweave-api` is built without its `schemars` feature",
38    note = "enable it: `queryweave-api = {{ version = \"..\", features = [\"schemars\"] }}`"
39)]
40pub trait Schemars {}
41
42#[cfg(feature = "schemars")]
43impl Schemars for crate::SortDirectionDto {}