Debian Codegraph @

third_party/rust/uniffi_bindgen/src/bindings/kotlin/gen_kotlin/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 use crate::ComponentInterface;
7
8 macro_rules! impl_code_type_for_miscellany {
9 ($T:ident, $class_name:literal, $canonical_name:literal) => {
10 #[derive(Debug)]
11 pub struct $T;
12
13 impl CodeType for $T {
14 fn type_label(&self, _ci: &ComponentInterface) -> String {
15 $class_name.into()
16 }
17
18 fn canonical_name(&self) -> String {
19 $canonical_name.into()
20 }
21 }
22 };
23 }
24
25 impl_code_type_for_miscellany!(TimestampCodeType, "java.time.Instant", "Timestamp");
26
27 impl_code_type_for_miscellany!(DurationCodeType, "java.time.Duration", "Duration");