-
Notifications
You must be signed in to change notification settings - Fork 234
/
Copy pathlib.rs
44 lines (36 loc) · 1.06 KB
/
lib.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use std::sync::Arc;
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct TraitMethods {
val: String,
}
impl TraitMethods {
fn new(val: String) -> Self {
Self { val }
}
}
impl std::fmt::Display for TraitMethods {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "TraitMethods({})", self.val)
}
}
#[derive(Debug, PartialEq, Eq, Hash, uniffi::Object)]
#[uniffi::export(Debug, Display, Eq, Hash)]
pub struct ProcTraitMethods {
val: String,
}
#[uniffi::export]
impl ProcTraitMethods {
#[uniffi::constructor]
fn new(val: String) -> Arc<Self> {
Arc::new(Self { val })
}
}
impl std::fmt::Display for ProcTraitMethods {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "ProcTraitMethods({})", self.val)
}
}
uniffi::include_scaffolding!("trait_methods");