Skip to content

Commit e5f1ad3

Browse files
committed
doc(instance) Add inline documentation.
1 parent 30f8bbb commit e5f1ad3

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

src/instance.rs

+3
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ impl ExportedFunctions {
2727
Self { instance }
2828
}
2929

30+
/// Check that an exported function exists.
3031
pub fn respond_to_missing(&self, method_name: &str) -> bool {
3132
self.instance.dyn_func(method_name).is_ok()
3233
}
@@ -173,10 +174,12 @@ methods!(
173174
RubyExportedFunctions,
174175
itself,
175176

177+
// Glue code to call the `ExportedFunctions.respond_to` method.
176178
fn ruby_exported_functions_method_exists(symbol: Symbol, _include_private: Boolean) -> Boolean {
177179
unwrap_or_raise(|| {
178180
let symbol = symbol?;
179181
let instance = itself.get_data(&*EXPORTED_FUNCTIONS_WRAPPER);
182+
180183
Ok(Boolean::new(instance.respond_to_missing(symbol.to_str())))
181184
})
182185
}

src/lib.rs

+3
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,13 @@ pub extern "C" fn Init_wasmer() {
3434
wasmer_module
3535
.define_nested_class("ExportedFunctions", Some(&exported_functions_data_class))
3636
.define(|itself| {
37+
// Declare the `respond_to_missing?` method.
3738
itself.def(
3839
"respond_to_missing?",
3940
instance::ruby_exported_functions_method_exists,
4041
);
42+
43+
// Declare the `method_missing` method.
4144
itself.def(
4245
"method_missing",
4346
instance::ruby_exported_functions_method_missing,

0 commit comments

Comments
 (0)