rust_require 0.2.3 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rust_require.rb +2 -0
- data/lib/rust_require/ruby_wrapper_generator.rb +1 -1
- data/lib/rust_require/struct.rb +28 -0
- data/lib/rust_require/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 484d36177135a18fa7f5e96964922ac838f76507
|
4
|
+
data.tar.gz: 1706cc6f34a642a562fa9c28ec4e00e0ace6bf40
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 78d8ab5c8913fb2707c4ef7cb925add94ee2effc133cbecb15bc25ebd07bfcb0ffd83eeafe955197a13953b8f0420abe06b3fe15301d2b81720297b75c564298
|
7
|
+
data.tar.gz: f791650c44a1aee9076e37d9a581bb73238563bbca48b4786ec2031945a51c8a7416a5b72d77f536d8dea5fbd8da662430b2824a570eef4e4ef8545f121c9fa4
|
data/lib/rust_require.rb
CHANGED
@@ -12,6 +12,8 @@ require_relative 'rust_require/rustc.rb'
|
|
12
12
|
require_relative 'rust_require/types.rb'
|
13
13
|
require_relative 'rust_require/c_wrapper_generator.rb'
|
14
14
|
require_relative 'rust_require/ruby_wrapper_generator.rb'
|
15
|
+
require_relative 'rust_require/struct.rb'
|
16
|
+
|
15
17
|
|
16
18
|
# Types
|
17
19
|
require_relative 'rust_require/types/primitives.rb'
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module Rust
|
2
|
+
class Struct < FFI::Struct
|
3
|
+
alias_method :old_get, :"[]"
|
4
|
+
alias_method :old_set, :"[]="
|
5
|
+
|
6
|
+
# TODO maybe type & bounds checking?
|
7
|
+
|
8
|
+
def [](field)
|
9
|
+
if field.respond_to? :to_sym
|
10
|
+
field = field.to_sym
|
11
|
+
elsif field.respond_to? :to_s
|
12
|
+
field = field.to_s.to_sym
|
13
|
+
end
|
14
|
+
|
15
|
+
old_get(field)
|
16
|
+
end
|
17
|
+
|
18
|
+
def []=(field, obj)
|
19
|
+
if field.respond_to? :to_sym
|
20
|
+
field = field.to_sym
|
21
|
+
elsif field.respond_to? :to_s
|
22
|
+
field = field.to_s.to_sym
|
23
|
+
end
|
24
|
+
|
25
|
+
old_set(field, obj)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
data/lib/rust_require/version.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
VERSION = "0.2.
|
1
|
+
VERSION = "0.2.4"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rust_require
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Florian Lackner
|
@@ -80,6 +80,7 @@ files:
|
|
80
80
|
- lib/rust_require/ruby_wrapper_generator.rb
|
81
81
|
- lib/rust_require/rust_require.rb
|
82
82
|
- lib/rust_require/rustc.rb
|
83
|
+
- lib/rust_require/struct.rb
|
83
84
|
- lib/rust_require/types.rb
|
84
85
|
- lib/rust_require/types/primitives.rb
|
85
86
|
- lib/rust_require/types/string.rb
|