Initial sketch

This commit is contained in:
Sergey Pepyakin
2017-11-25 22:28:15 +03:00
parent 0b5939e4e7
commit 6a3b9af597
4 changed files with 93 additions and 19 deletions

View File

@ -121,7 +121,6 @@ pub struct CallerContext<'a, E: 'a + UserError> {
}
/// Internal function reference.
#[derive(Clone)]
pub struct InternalFunctionReference<'a, E: UserError> {
/// Module reference.
pub module: Arc<ModuleInstanceInterface<E> + 'a>,
@ -129,6 +128,16 @@ pub struct InternalFunctionReference<'a, E: UserError> {
pub internal_index: u32,
}
// TODO: This impl should be removed once `E` not needed anymore.
impl<'a, E> Clone for InternalFunctionReference<'a, E> where E: UserError {
fn clone(&self) -> InternalFunctionReference<'a, E> {
InternalFunctionReference {
module: Arc::clone(&self.module),
internal_index: self.internal_index,
}
}
}
impl<'a, E> fmt::Debug for InternalFunctionReference<'a, E> where E: UserError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "InternalFunctionReference")