Class: Rust::Slice

Inherits:
FFI::Struct
  • Object
show all
Defined in:
lib/rust_require/types.rb

Overview

a rust fat pointer

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.from(start, len) ⇒ Object



7
8
9
10
11
12
# File 'lib/rust_require/types.rb', line 7

def self.from(start, len)
  s = new
  s[:ptr] = start
  s[:len] = len
  s
end

Instance Method Details

#unpackObject



14
15
16
# File 'lib/rust_require/types.rb', line 14

def unpack
  [self[:ptr], self[:len]]
end