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
use crate::{impl_wrapper_common, impl_wrapper_from, Env, RawVal, Tag};
use core::cmp::{Eq, Ord, PartialEq, PartialOrd};
use stellar_xdr::ScStatic;
#[derive(Copy, Clone)]
pub struct Static(RawVal);
impl_wrapper_common!(Static);
impl_wrapper_from!((), Static);
impl_wrapper_from!(bool, Static);
impl Eq for Static {}
impl PartialEq for Static {
fn eq(&self, other: &Self) -> bool {
self.as_raw().get_payload() == other.as_raw().get_payload()
}
}
impl Ord for Static {
fn cmp(&self, other: &Self) -> core::cmp::Ordering {
self.as_raw()
.get_payload()
.cmp(&other.as_raw().get_payload())
}
}
impl PartialOrd for Static {
fn partial_cmp(&self, other: &Self) -> Option<core::cmp::Ordering> {
Some(self.cmp(other))
}
}
impl Static {
#[inline(always)]
pub const fn is_type(&self, ty: ScStatic) -> bool {
self.as_raw().has_minor(ty as u32)
}
}