mirror of
https://github.com/meilisearch/meilisearch.git
synced 2025-02-24 03:25:43 +08:00
updated code
This commit is contained in:
parent
1fb96d3edb
commit
7b4f2aa593
@ -25,23 +25,10 @@ use crate::Opt;
|
|||||||
/// It also generates a `configure` function that configures the routes for the settings.
|
/// It also generates a `configure` function that configures the routes for the settings.
|
||||||
macro_rules! make_setting_routes {
|
macro_rules! make_setting_routes {
|
||||||
($({route: $route:literal, update_verb: $update_verb:ident, value_type: $type:ty, err_type: $err_ty:ty, attr: $attr:ident, camelcase_attr: $camelcase_attr:literal, analytics: $analytics:ident},)*) => {
|
($({route: $route:literal, update_verb: $update_verb:ident, value_type: $type:ty, err_type: $err_ty:ty, attr: $attr:ident, camelcase_attr: $camelcase_attr:literal, analytics: $analytics:ident},)*) => {
|
||||||
#[allow(dead_code)]
|
const _: fn(&meilisearch_types::settings::Settings<meilisearch_types::settings::Unchecked>) = |s| {
|
||||||
const _: () = {
|
// This pattern match will fail at compile time if any field in Settings is not listed in the macro
|
||||||
// First, verify that all fields in Settings are listed in the macro
|
match *s {
|
||||||
const fn __verify_settings_exist() {
|
meilisearch_types::settings::Settings { $($attr: _,)* _kind: _ } => {}
|
||||||
// This pattern match will fail at compile time if any field is missing from the macro
|
|
||||||
// or if a field exists in the macro but not in Settings
|
|
||||||
let _: fn(meilisearch_types::settings::Settings<meilisearch_types::settings::Unchecked>) = |s| {
|
|
||||||
match s {
|
|
||||||
meilisearch_types::settings::Settings {
|
|
||||||
$($attr: _,)*
|
|
||||||
_kind: _,
|
|
||||||
} => {}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// if any field is missing or has the wrong type
|
|
||||||
let _: fn(meilisearch_types::settings::Settings<meilisearch_types::settings::Unchecked>) = |_| {};
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user