Debian Codegraph @

third_party/rust/uniffi_bindgen/src/bindings/python/gen_python/miscellany.rs

raw
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4
5 use super::CodeType;
6
7 macro_rules! impl_code_type_for_miscellany {
8 ($T:ident, $canonical_name:literal) => {
9 #[derive(Debug)]
10 pub struct $T;
11
12 impl CodeType for $T {
13 fn type_label(&self) -> String {
14 format!("{}", $canonical_name)
15 }
16
17 fn canonical_name(&self) -> String {
18 format!("{}", $canonical_name)
19 }
20 }
21 };
22 }
23
24 impl_code_type_for_miscellany!(TimestampCodeType, "Timestamp");
25
26 impl_code_type_for_miscellany!(DurationCodeType, "Duration");