rscsv 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -1
- data/Cargo.lock +21 -21
- data/Cargo.toml +2 -2
- data/lib/rscsv/version.rb +1 -1
- data/lib/tasks/helix_runtime.rake +1 -10
- data/rscsv.gemspec +2 -1
- data/src/lib.rs +26 -17
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d4be72bac8c595ee40b13567f4c9dbdf364e54f7
|
4
|
+
data.tar.gz: '0209d8f85af351b0962151d91bdef1d543423a47'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1138906ef09ff7c845e678006f8455249345764c894879cc0466d55b45c0b0871dce1a19498e1fca57af37c6fd94ce39d70537e6e47a1b8848984c153a5191dc
|
7
|
+
data.tar.gz: 84872416860db893d1efd41509a33c19ffdc9d9ac0b4b2b3e07cdc47de528b2163103082aed479a5589361501139a1f8a1feecceed3bb79d65671cb3aad319e6
|
data/.travis.yml
CHANGED
@@ -4,7 +4,7 @@ rvm:
|
|
4
4
|
- 2.4.1
|
5
5
|
- 2.3.3
|
6
6
|
before_install:
|
7
|
-
- gem install bundler -v 1.
|
7
|
+
- gem install bundler -v 1.15.4
|
8
8
|
- if [ ! -e "$HOME/.cargo/bin" ]; then curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain stable -y; fi
|
9
9
|
- export PATH="$HOME/.cargo/bin:$PATH"
|
10
10
|
- rustup default stable
|
data/Cargo.lock
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
[root]
|
2
2
|
name = "rscsv"
|
3
|
-
version = "0.
|
3
|
+
version = "0.3.0"
|
4
4
|
dependencies = [
|
5
|
-
"csv 1.0.0-beta.
|
6
|
-
"helix 0.6.
|
5
|
+
"csv 1.0.0-beta.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
6
|
+
"helix 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
7
7
|
]
|
8
8
|
|
9
9
|
[[package]]
|
@@ -18,16 +18,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
18
18
|
|
19
19
|
[[package]]
|
20
20
|
name = "csv"
|
21
|
-
version = "1.0.0-beta.
|
21
|
+
version = "1.0.0-beta.4"
|
22
22
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
23
23
|
dependencies = [
|
24
|
-
"csv-core 0.1.
|
25
|
-
"serde 1.0.
|
24
|
+
"csv-core 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
25
|
+
"serde 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
26
26
|
]
|
27
27
|
|
28
28
|
[[package]]
|
29
29
|
name = "csv-core"
|
30
|
-
version = "0.1.
|
30
|
+
version = "0.1.3"
|
31
31
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
32
32
|
dependencies = [
|
33
33
|
"memchr 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
@@ -35,26 +35,26 @@ dependencies = [
|
|
35
35
|
|
36
36
|
[[package]]
|
37
37
|
name = "helix"
|
38
|
-
version = "0.6.
|
38
|
+
version = "0.6.2"
|
39
39
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
40
40
|
dependencies = [
|
41
41
|
"cslice 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
42
42
|
"cstr-macro 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
43
|
-
"libc 0.2.
|
44
|
-
"libcruby-sys 0.6.
|
43
|
+
"libc 0.2.30 (registry+https://github.com/rust-lang/crates.io-index)",
|
44
|
+
"libcruby-sys 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
45
45
|
]
|
46
46
|
|
47
47
|
[[package]]
|
48
48
|
name = "libc"
|
49
|
-
version = "0.2.
|
49
|
+
version = "0.2.30"
|
50
50
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
51
51
|
|
52
52
|
[[package]]
|
53
53
|
name = "libcruby-sys"
|
54
|
-
version = "0.6.
|
54
|
+
version = "0.6.2"
|
55
55
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
56
56
|
dependencies = [
|
57
|
-
"libc 0.2.
|
57
|
+
"libc 0.2.30 (registry+https://github.com/rust-lang/crates.io-index)",
|
58
58
|
]
|
59
59
|
|
60
60
|
[[package]]
|
@@ -62,21 +62,21 @@ name = "memchr"
|
|
62
62
|
version = "1.0.1"
|
63
63
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
64
64
|
dependencies = [
|
65
|
-
"libc 0.2.
|
65
|
+
"libc 0.2.30 (registry+https://github.com/rust-lang/crates.io-index)",
|
66
66
|
]
|
67
67
|
|
68
68
|
[[package]]
|
69
69
|
name = "serde"
|
70
|
-
version = "1.0.
|
70
|
+
version = "1.0.11"
|
71
71
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
72
72
|
|
73
73
|
[metadata]
|
74
74
|
"checksum cslice 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0f8cb7306107e4b10e64994de6d3274bd08996a7c1322a27b86482392f96be0a"
|
75
75
|
"checksum cstr-macro 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "db53fddba18cdd35477a7213a3ef6acfbfa333c31b42ce019e544c4a1420a06f"
|
76
|
-
"checksum csv 1.0.0-beta.
|
77
|
-
"checksum csv-core 0.1.
|
78
|
-
"checksum helix 0.6.
|
79
|
-
"checksum libc 0.2.
|
80
|
-
"checksum libcruby-sys 0.6.
|
76
|
+
"checksum csv 1.0.0-beta.4 (registry+https://github.com/rust-lang/crates.io-index)" = "a841f3bc2c613b7a3e892c9c4404044de9dab6bc506e253bf8ef05ef906531e5"
|
77
|
+
"checksum csv-core 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ae1fbabf21d9a52d04675cc5b032d7bae24ecdcd22646f7eefcd0496a122686c"
|
78
|
+
"checksum helix 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f8d1d484452e11351d333dc0f13cce78226edbff63ef332ddb6d7babb58e796c"
|
79
|
+
"checksum libc 0.2.30 (registry+https://github.com/rust-lang/crates.io-index)" = "2370ca07ec338939e356443dac2296f581453c35fe1e3a3ed06023c49435f915"
|
80
|
+
"checksum libcruby-sys 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d8b542ce0e28b37e1ca06887c45bb0693d80a413361931dabffd309c1fd8d55b"
|
81
81
|
"checksum memchr 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1dbccc0e46f1ea47b9f17e6d67c5a96bd27030519c519c9c91327e31275a47b4"
|
82
|
-
"checksum serde 1.0.
|
82
|
+
"checksum serde 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)" = "f7726f29ddf9731b17ff113c461e362c381d9d69433f79de4f3dd572488823e9"
|
data/Cargo.toml
CHANGED
data/lib/rscsv/version.rb
CHANGED
@@ -1,14 +1,5 @@
|
|
1
1
|
require 'helix_runtime/build_task'
|
2
2
|
|
3
|
-
HelixRuntime::BuildTask.new
|
4
|
-
|
5
|
-
# Monkey-patch project name as directory name varies during installation
|
6
|
-
module HelixRuntime
|
7
|
-
class Project
|
8
|
-
def name
|
9
|
-
'rscsv'
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
3
|
+
HelixRuntime::BuildTask.new
|
13
4
|
|
14
5
|
task :default => :build
|
data/rscsv.gemspec
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# coding: utf-8
|
2
|
+
|
2
3
|
lib = File.expand_path('../lib', __FILE__)
|
3
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
5
|
require 'rscsv/version'
|
@@ -22,7 +23,7 @@ Gem::Specification.new do |spec|
|
|
22
23
|
spec.require_paths = ['lib']
|
23
24
|
spec.extensions = Dir['ext/extconf.rb']
|
24
25
|
|
25
|
-
spec.add_dependency 'helix_runtime', '0.6.
|
26
|
+
spec.add_dependency 'helix_runtime', '0.6.2'
|
26
27
|
spec.add_dependency 'rake', '>= 10.0'
|
27
28
|
spec.add_development_dependency 'bundler', '~> 1.14'
|
28
29
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
data/src/lib.rs
CHANGED
@@ -6,14 +6,15 @@ use std::error::Error;
|
|
6
6
|
use std::io::Read;
|
7
7
|
use std::slice::from_raw_parts;
|
8
8
|
use helix::sys;
|
9
|
-
use helix::sys::{
|
10
|
-
use helix::{
|
9
|
+
use helix::sys::{ID, VALUE};
|
10
|
+
use helix::{CheckResult, CheckedValue, ToRuby, ToRust, UncheckedValue};
|
11
11
|
use helix::libc::c_int;
|
12
12
|
|
13
13
|
struct VecWrap<T>(Vec<T>);
|
14
14
|
|
15
15
|
impl<T> UncheckedValue<VecWrap<T>> for VALUE
|
16
|
-
|
16
|
+
where
|
17
|
+
VALUE: UncheckedValue<T>,
|
17
18
|
{
|
18
19
|
fn to_checked(self) -> CheckResult<VecWrap<T>> {
|
19
20
|
if unsafe { sys::RB_TYPE_P(self, sys::T_ARRAY) } {
|
@@ -26,8 +27,10 @@ impl<T> UncheckedValue<VecWrap<T>> for VALUE
|
|
26
27
|
Ok(unsafe { CheckedValue::<VecWrap<T>>::new(self) })
|
27
28
|
} else {
|
28
29
|
let val = unsafe { CheckedValue::<String>::new(sys::rb_inspect(self)) };
|
29
|
-
Err(format!(
|
30
|
-
|
30
|
+
Err(format!(
|
31
|
+
"No implicit conversion of {} into Vec<String>",
|
32
|
+
val.to_rust()
|
33
|
+
))
|
31
34
|
}
|
32
35
|
}
|
33
36
|
}
|
@@ -38,8 +41,9 @@ fn ruby_array_to_slice<'a>(array: VALUE) -> &'a [VALUE] {
|
|
38
41
|
}
|
39
42
|
|
40
43
|
impl ToRust<VecWrap<String>> for CheckedValue<VecWrap<String>>
|
41
|
-
|
42
|
-
|
44
|
+
where
|
45
|
+
VALUE: UncheckedValue<String>,
|
46
|
+
CheckedValue<String>: ToRust<String>,
|
43
47
|
{
|
44
48
|
fn to_rust(self) -> VecWrap<String> {
|
45
49
|
let slice = ruby_array_to_slice(self.inner);
|
@@ -53,8 +57,9 @@ impl ToRust<VecWrap<String>> for CheckedValue<VecWrap<String>>
|
|
53
57
|
}
|
54
58
|
|
55
59
|
impl ToRust<VecWrap<VecWrap<String>>> for CheckedValue<VecWrap<VecWrap<String>>>
|
56
|
-
|
57
|
-
|
60
|
+
where
|
61
|
+
VALUE: UncheckedValue<VecWrap<String>>,
|
62
|
+
CheckedValue<VecWrap<String>>: ToRust<VecWrap<String>>,
|
58
63
|
{
|
59
64
|
fn to_rust(self) -> VecWrap<VecWrap<String>> {
|
60
65
|
let slice = ruby_array_to_slice(self.inner);
|
@@ -67,7 +72,7 @@ impl ToRust<VecWrap<VecWrap<String>>> for CheckedValue<VecWrap<VecWrap<String>>>
|
|
67
72
|
}
|
68
73
|
}
|
69
74
|
|
70
|
-
#[cfg_attr(windows, link(name="helix-runtime"))]
|
75
|
+
#[cfg_attr(windows, link(name = "helix-runtime"))]
|
71
76
|
extern "C" {
|
72
77
|
pub fn rb_ary_new_capa(capa: isize) -> VALUE;
|
73
78
|
pub fn rb_ary_entry(ary: VALUE, offset: isize) -> VALUE;
|
@@ -108,8 +113,8 @@ fn record_to_ruby(record: &csv::ByteRecord) -> VALUE {
|
|
108
113
|
let inner_array = unsafe { rb_ary_new_capa(record.len() as isize) };
|
109
114
|
for column in record.iter() {
|
110
115
|
unsafe {
|
111
|
-
let column_value =
|
112
|
-
|
116
|
+
let column_value =
|
117
|
+
sys::rb_utf8_str_new(column.as_ptr() as *const i8, column.len() as i64);
|
113
118
|
rb_ary_push(inner_array, column_value);
|
114
119
|
}
|
115
120
|
}
|
@@ -169,13 +174,17 @@ impl EnumeratorRead {
|
|
169
174
|
|
170
175
|
fn read_from_external(&mut self, buf: &mut [u8]) -> std::io::Result<usize> {
|
171
176
|
let next = unsafe {
|
172
|
-
rb_funcall(
|
173
|
-
|
174
|
-
|
177
|
+
rb_funcall(
|
178
|
+
self.value,
|
179
|
+
sys::rb_intern("next\0".as_ptr() as *const i8),
|
180
|
+
0,
|
181
|
+
)
|
175
182
|
};
|
176
183
|
let slice = unsafe {
|
177
|
-
from_raw_parts(
|
178
|
-
|
184
|
+
from_raw_parts(
|
185
|
+
sys::RSTRING_PTR(next) as *const u8,
|
186
|
+
sys::RSTRING_LEN(next) as usize,
|
187
|
+
)
|
179
188
|
};
|
180
189
|
|
181
190
|
self.read_and_store_overflow(buf, slice)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rscsv
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ville Lautanala
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-08-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: helix_runtime
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.6.
|
19
|
+
version: 0.6.2
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.6.
|
26
|
+
version: 0.6.2
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|