Skip to content

Commit

Permalink
fix(vm): Implement Getable for Function<RootedThread, _>
Browse files Browse the repository at this point in the history
  • Loading branch information
Marwes committed Dec 20, 2016
1 parent b56549c commit 73f4feb
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions vm/src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1572,6 +1572,7 @@ impl<'vm, T, F: Any> Pushable<'vm> for Function<T, F>
Ok(())
}
}

impl<'vm, F> Getable<'vm> for Function<&'vm Thread, F> {
fn from_value(vm: &'vm Thread, value: Variants) -> Option<Function<&'vm Thread, F>> {
Some(Function {
Expand All @@ -1581,6 +1582,15 @@ impl<'vm, F> Getable<'vm> for Function<&'vm Thread, F> {
}
}

impl<'vm, F> Getable<'vm> for Function<RootedThread, F> {
fn from_value(vm: &'vm Thread, value: Variants) -> Option<Self> {
Some(Function {
value: vm.root_value(*value.0),
_marker: PhantomData,
})//TODO not type safe
}
}

/// Trait which represents a function
pub trait FunctionType {
/// Returns how many arguments the function needs to be provided to call it
Expand Down

0 comments on commit 73f4feb

Please sign in to comment.