new implementations and one less lifetime bug
Signed-off-by: Ava Hahn <ava@aidanis.online>
This commit is contained in:
parent
0a14ea7182
commit
e6bb732f18
2 changed files with 12 additions and 1 deletions
|
|
@ -49,6 +49,10 @@ impl<'a> FTable<'a> {
|
||||||
pub fn remove(&self, id: String) {
|
pub fn remove(&self, id: String) {
|
||||||
self.0.remove(&id);
|
self.0.remove(&id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn new() -> FTable<'a> {
|
||||||
|
FTable{0: HashMap::<String, Box<Function>>::new()}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -35,12 +35,19 @@ impl<'a> VTable<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get(&'a self, id: String) -> Option<Box<Ctr<'a>>> {
|
pub fn get(&'a self, id: String) -> Option<Box<Ctr<'a>>> {
|
||||||
self.0.get(&id)
|
match self.0.get(&id) {
|
||||||
|
Some(s) => Some(s.clone()),
|
||||||
|
None => None,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn remove(&self, id: String) {
|
pub fn remove(&self, id: String) {
|
||||||
self.0.remove(&id);
|
self.0.remove(&id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn new() -> VTable<'a> {
|
||||||
|
VTable{0: HashMap::<String, Box<Ctr>>::new()}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// returns a callback for the stdlib var export function with env_sync on or off
|
// returns a callback for the stdlib var export function with env_sync on or off
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue