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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
use std::sync::*;
use clojure::lang::*;
use clojure::rust::*;
use intertrait::*;
use lazy_static::lazy_static;
use crate::*;
castable_to!(SGlobals => [sync] IObject, Globals);
pub struct SGlobals {
unique_name: Object,
obj_vect: Object,
}
pub trait Globals: IObject+CastFromSync {
fn update(
&mut self,
name: &str,
value: &Object,
) -> ObjResult<Object>;
fn get_obj_by_id(
&self,
index: usize,
) -> ObjResult<Object>;
fn get_obj_by_name(
&self,
name: &str,
) -> ObjResult<Object>;
fn get_id_for_name(
&self,
name: &str,
) -> ObjResult<Object>;
}
impl SGlobals {
fn new() -> Object { new_obj!(SGlobals::default()) }
}
use crate::new_obj;
impl Globals for SGlobals {
fn update(
&mut self,
name: &str,
value: &Object,
) -> ObjResult<Object> {
todo!()
}
fn get_obj_by_id(
&self,
index: usize,
) -> ObjResult<Object> {
todo!()
}
fn get_obj_by_name(
&self,
name: &str,
) -> ObjResult<Object> {
todo!()
}
fn get_id_for_name(
&self,
name: &str,
) -> ObjResult<Object> {
todo!()
}
}
impl IObject for SGlobals {
fn getClass<'a>(&self) -> &'a SClass { todo!() }
fn hashCode(&self) -> usize { todo!() }
fn equals(
&self,
other: &Object,
) -> bool {
todo!()
}
fn toString(&self) -> String { todo!() }
}
impl Default for SGlobals {
fn default() -> Self {
SGlobals {
unique_name: SUnique::new(),
obj_vect: new_obj!(SPersistentVector::default()),
}
}
}
lazy_static! {
pub static ref CLASSES: Object = Object {
inner: None,
};
pub static ref PROTOCOLS: Object = Object {
inner: None,
};
}