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
45
46
47
48
use super::*;
#[doc(hidden)]
pub trait IntoParam<'a, T: Abi> {
fn into_param(self) -> Param<'a, T>;
}
impl<'a, T: Abi> IntoParam<'a, T> for T {
fn into_param(self) -> Param<'a, T> {
Param::Owned(self)
}
}
impl<'a, T: Abi> IntoParam<'a, T> for &'a T {
fn into_param(self) -> Param<'a, T> {
Param::Borrowed(self)
}
}
impl<'a, T: Abi> IntoParam<'a, T> for Option<T> {
fn into_param(self) -> Param<'a, T> {
match self {
Some(value) => Param::Owned(value),
None => Param::None,
}
}
}
impl<'a, T: Abi> IntoParam<'a, T> for &'a Option<T> {
fn into_param(self) -> Param<'a, T> {
match self {
Some(value) => Param::Borrowed(value),
None => Param::None,
}
}
}
impl<'a> IntoParam<'a, HSTRING> for &str {
fn into_param(self) -> Param<'a, HSTRING> {
Param::Owned(self.into())
}
}
impl<'a> IntoParam<'a, HSTRING> for String {
fn into_param(self) -> Param<'a, HSTRING> {
Param::Owned(self.into())
}
}