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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
//! Extra trait impls required by the bounds to `SorobanArbitrary`.
//!
//! These are in their own module so that they are defined even when "testutils"
//! is not configured, making type inference consistent between configurations.

use crate::ConversionError;
use crate::Error;
use crate::{Env, TryFromVal};

impl TryFromVal<Env, u32> for u32 {
    type Error = ConversionError;
    fn try_from_val(_env: &Env, v: &u32) -> Result<Self, Self::Error> {
        Ok(*v)
    }
}

impl TryFromVal<Env, i32> for i32 {
    type Error = ConversionError;
    fn try_from_val(_env: &Env, v: &i32) -> Result<Self, Self::Error> {
        Ok(*v)
    }
}

impl TryFromVal<Env, u64> for u64 {
    type Error = ConversionError;
    fn try_from_val(_env: &Env, v: &u64) -> Result<Self, Self::Error> {
        Ok(*v)
    }
}

impl TryFromVal<Env, i64> for i64 {
    type Error = ConversionError;
    fn try_from_val(_env: &Env, v: &i64) -> Result<Self, Self::Error> {
        Ok(*v)
    }
}

impl TryFromVal<Env, u128> for u128 {
    type Error = ConversionError;
    fn try_from_val(_env: &Env, v: &u128) -> Result<Self, Self::Error> {
        Ok(*v)
    }
}

impl TryFromVal<Env, i128> for i128 {
    type Error = ConversionError;
    fn try_from_val(_env: &Env, v: &i128) -> Result<Self, Self::Error> {
        Ok(*v)
    }
}

impl TryFromVal<Env, bool> for bool {
    type Error = ConversionError;
    fn try_from_val(_env: &Env, v: &bool) -> Result<Self, Self::Error> {
        Ok(*v)
    }
}

impl TryFromVal<Env, ()> for () {
    type Error = ConversionError;
    fn try_from_val(_env: &Env, v: &()) -> Result<Self, Self::Error> {
        Ok(*v)
    }
}

impl TryFromVal<Env, Error> for Error {
    type Error = ConversionError;
    fn try_from_val(_env: &Env, v: &Error) -> Result<Self, Self::Error> {
        Ok(*v)
    }
}