-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enhance Wasmer::XxxArray
#15
Conversation
src/memory/view.rs
Outdated
let view = self.memory.view::<$wasm_type>(); | ||
|
||
let mut offset = self.offset; | ||
while offset < view.len() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can write:
for nth in self.offset..view.len() {
let value = view[nth].get() as i64;
VM::yield_object(Integer::from(value))
}
It's more Rust idiomatic, and it avoids misusing the stop condition.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I fixed.
Should we support |
bors try |
tryBuild succeeded |
Since the type of elements such as If we implement the method mem1 = instance.memory.int8_view
mem2 = another_instance.memory.int8_view
[mem1, mem2].sort! Note: Ruby's |
I agree |
bors r+ |
15: Enhance `Wasmer::XxxArray` r=Hywan a=irxground ref: #14 Now `Wasmer::XxxArray` has `each` method and include `Enumerable` module. > The Enumerable mixin provides collection classes with several traversal and searching methods, and with the ability to sort. The class must provide a method each, which yields successive members of the collection. https://docs.ruby-lang.org/en/2.6.0/Enumerable.html Co-authored-by: irxground <irxnjhtchlnrw@gmail.com>
Thanks for the great PR! |
Build succeeded |
This is awesome! |
ref: #14
Now
Wasmer::XxxArray
haseach
method and includeEnumerable
module.