Debian Codegraph @

third_party/rust/uniffi_bindgen/src/bindings/kotlin/gen_kotlin/custom.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 #[derive(Debug)]
9 pub struct CustomCodeType {
10 name: String,
11 }
12
13 impl CustomCodeType {
14 pub fn new(name: String) -> Self {
15 CustomCodeType { name }
16 }
17 }
18
19 impl CodeType for CustomCodeType {
20 fn type_label(&self, ci: &ComponentInterface) -> String {
21 super::KotlinCodeOracle.class_name(ci, &self.name)
22 }
23
24 fn canonical_name(&self) -> String {
25 format!("Type{}", self.name)
26 }
27 }