Created
July 21, 2015 08:25
-
-
Save mfpiccolo/d52f87db4590158ecd57 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'ffi' | |
module Scrape | |
extend FFI::Library | |
ffi_lib './target/debug/libscrape.dylib' | |
class FromRustArray < FFI::Struct | |
layout :len, :size_t, # dynamic array layout | |
:data, :pointer # | |
def to_a | |
self[:data].get_array_of_string(0, self[:len]).compact | |
end | |
end | |
attach_function :number_to_char_array, [], FromRustArray.by_value | |
end | |
p Scrape.number_to_char_array.to_a |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment