Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lautis/rscsv
Experiments combining Ruby, Rust, and CSV
https://github.com/lautis/rscsv
csv ruby rust
Last synced: 3 months ago
JSON representation
Experiments combining Ruby, Rust, and CSV
- Host: GitHub
- URL: https://github.com/lautis/rscsv
- Owner: lautis
- License: mit
- Created: 2017-05-09T22:48:15.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-03-31T11:12:27.000Z (almost 6 years ago)
- Last Synced: 2024-09-29T20:42:02.906Z (3 months ago)
- Topics: csv, ruby, rust
- Language: Ruby
- Size: 77.1 KB
- Stars: 16
- Watchers: 4
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Rscsv
Fast CSV using Rust extensions. Can read arrays of arrays from strings and write
strings from arrays of arrays.[![Build Status](https://travis-ci.org/lautis/rscsv.svg?branch=master)](https://travis-ci.org/lautis/rscsv)
## Installation
This gem requires Rust (~> 1.17) and Cargo to be installed. With those
requirements fulfilled, rscsv can be installed like any other gem:```
gem install rscsv
```## Usage
```ruby
require 'rscsv'Rscsv::Writer.generate_lines([['1', '2', '3'], ['3', '4', '5']])
# => 1,2,3\n4,5,6\n
Rscsv::Writer.generate_line(['1', '2', '3'])
# => 1,2,3\nRscsv::Reader.parse("1,2,3\n4,5,6\n")
# => [["1", "2", "3"], ["4", "5", "6"]]# Streaming from Enumerator
Rscsv::Reader.each(["1,2,3\n","4,5,6\n"].each) do |row|
# yields ["1", "2", "3"] and ["4", "5", "6"]
end
```This is ~3x faster than using native Ruby `CSV.generate` or `CSV.parse`.