Project

rscsv

0.01
Low commit activity in last 3 years
A long-lived project that still receives updates
Fast CSV using Rust extensions.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

~> 3.0
>= 2.0
>= 3.0
>= 13.0

Runtime

~> 0.9
 Project Readme

Rscsv

Fast CSV using Rust extensions. Can read arrays of arrays from strings and write strings from arrays of arrays.

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

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\n

Rscsv::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.