commit_hash stringlengths 40 40 | author stringlengths 1 57 | date timestamp[s]date 2010-07-26 04:45:09 2026-04-14 18:21:10 | message stringlengths 8 1.39M | diff stringlengths 68 51.2k | files_changed int64 1 136 | insertions int64 0 2.35k | deletions int64 0 1.9k |
|---|---|---|---|---|---|---|---|
8e88706303d5a5c2146f852b9cfdf22d16291b4c | Andrew Gallant | 2014-10-04T14:44:54 | We don't need an immutable view into the buffer. | diff --git a/src/buffered.rs b/src/buffered.rs
index b4f0722..a69ce55 100644
--- a/src/buffered.rs
+++ b/src/buffered.rs
@@ -34,7 +34,6 @@ impl<R: Reader> BufferedReader<R> {
BufferedReader::with_capacity(DEFAULT_BUF_SIZE, inner)
}
- pub fn get_ref<'a>(&'a self) -> &'a R { &self.inner }
pub fn g... | 1 | 0 | 1 |
b5d924fc86f7c5ea2c0ec7c90b21c539e12952f5 | Andrew Gallant | 2014-10-04T14:44:03 | Move the seek optimization into the CSV reader. | diff --git a/src/index/mod.rs b/src/index/mod.rs
index 57c644a..c22effe 100644
--- a/src/index/mod.rs
+++ b/src/index/mod.rs
@@ -24,9 +24,6 @@ impl<R: io::Reader + io::Seek, I: io::Reader + io::Seek> Indexed<R, I> {
// Why does `seek` want an `i64`?
try!(self.idx.seek((i * 8) as i64, io::SeekSet).map_... | 2 | 6 | 3 |
bb336ffd9f69522c98e0c5f9abf24735d2bf612f | Andrew Gallant | 2014-10-04T05:45:21 | An optimization that doesn't seek if it isn't necessary.
This avoids an extra seek and re-buffering, but you still have to
pay for the seek+read on the index. | diff --git a/src/buffered.rs b/src/buffered.rs
index a69ce55..b4f0722 100644
--- a/src/buffered.rs
+++ b/src/buffered.rs
@@ -34,6 +34,7 @@ impl<R: Reader> BufferedReader<R> {
BufferedReader::with_capacity(DEFAULT_BUF_SIZE, inner)
}
+ pub fn get_ref<'a>(&'a self) -> &'a R { &self.inner }
pub fn g... | 3 | 5 | 0 |
4b8cc16a4a52d55c95ea914df972c5fcc0800c5d | Andrew Gallant | 2014-10-04T03:04:57 | Adding some undocumented functions for performance reasons. | diff --git a/src/reader.rs b/src/reader.rs
index cfb9e16..395d535 100644
--- a/src/reader.rs
+++ b/src/reader.rs
@@ -596,6 +596,22 @@ impl<R: io::Reader> Reader<R> {
Some(Ok((*pmachine.fieldbuf)[]))
}
+ /// An unsafe iterator over byte fields.
+ ///
+ /// This iterator calls `next_field` at eac... | 3 | 65 | 2 |
728cc01da4c19be641e02a636b24a3bee93fd1af | Andrew Gallant | 2014-10-03T17:07:36 | Revert "Revert "Remove uses of unsafe that were *actually* unsafe.""
This reverts commit e17340ea2876b2a38bbd31f8834390d27bfa06ab. | diff --git a/src/bench.rs b/src/bench.rs
index ff4904e..cf01228 100644
--- a/src/bench.rs
+++ b/src/bench.rs
@@ -33,7 +33,12 @@ fn raw_records(b: &mut Bencher) {
b.iter(|| {
let mut dec = reader(&mut data);
while !dec.done() {
- for r in dec { let _ = r.unwrap(); }
+ loop {
... | 5 | 138 | 90 |
e17340ea2876b2a38bbd31f8834390d27bfa06ab | Andrew Gallant | 2014-10-03T16:57:28 | Revert "Remove uses of unsafe that were *actually* unsafe."
This reverts commit 5af0d4d0d8f026a7bb266a552888939ba93d80f0. | diff --git a/src/bench.rs b/src/bench.rs
index cf01228..ff4904e 100644
--- a/src/bench.rs
+++ b/src/bench.rs
@@ -33,12 +33,7 @@ fn raw_records(b: &mut Bencher) {
b.iter(|| {
let mut dec = reader(&mut data);
while !dec.done() {
- loop {
- match dec.next_field() {
- ... | 5 | 90 | 138 |
5af0d4d0d8f026a7bb266a552888939ba93d80f0 | Andrew Gallant | 2014-10-03T13:35:07 | Remove uses of unsafe that were *actually* unsafe.
Unfortunately, this means that the "raw" field iterator can't
actually implement Iterator. Bah, humbug!
This will break any use of raw field iteration. Code that looks like
this:
while !rdr.done() {
for field in rdr {
let field = field.unwrap... | diff --git a/src/bench.rs b/src/bench.rs
index ff4904e..cf01228 100644
--- a/src/bench.rs
+++ b/src/bench.rs
@@ -33,7 +33,12 @@ fn raw_records(b: &mut Bencher) {
b.iter(|| {
let mut dec = reader(&mut data);
while !dec.done() {
- for r in dec { let _ = r.unwrap(); }
+ loop {
... | 5 | 138 | 90 |
03ef88594b402758bdda56bca6908eed69d42fef | Andrew Gallant | 2014-09-29T00:34:27 | Make indexing work correctly with headers. | diff --git a/src/index/mod.rs b/src/index/mod.rs
index d1d5f41..ce6a5ca 100644
--- a/src/index/mod.rs
+++ b/src/index/mod.rs
@@ -12,12 +12,15 @@ pub struct Indexed<R, I> {
impl<R: io::Reader + io::Seek, I: io::Reader + io::Seek> Indexed<R, I> {
pub fn new(rdr: Reader<R>, idx: I) -> Indexed<R, I> {
Indexe... | 2 | 9 | 3 |
a68f3d96d442656ccc8a76a9deb5a51f2455a181 | Andrew Gallant | 2014-09-28T21:08:45 | Simplify index sub-module.
I feel like there's room for more convenience functions, but
I'm going to let it simmer with a bare bones interface for now. | diff --git a/src/index/mod.rs b/src/index/mod.rs
index 7599c3e..2424eb2 100644
--- a/src/index/mod.rs
+++ b/src/index/mod.rs
@@ -1,7 +1,6 @@
#![allow(missing_doc)]
-use std::io::{mod, File};
-use std::path::BytesContainer;
+use std::io;
use {CsvResult, ErrIo, Reader};
@@ -10,18 +9,10 @@ pub struct Indexed<R, I>... | 1 | 5 | 26 |
7e886f7c86a1a46d79bec96be25c8054498a5d34 | Andrew Gallant | 2014-09-24T01:06:09 | Fix example. | diff --git a/examples/stream.rs b/examples/stream.rs
index f635e89..799a27e 100644
--- a/examples/stream.rs
+++ b/examples/stream.rs
@@ -23,7 +23,7 @@ fn main() {
// We create a CSV reader with a small buffer so that we can see streaming
// in action on small inputs.
let buf = io::BufferedReader::with_ca... | 1 | 1 | 1 |
5c9350fade1995bb97cdff3e0e09081d2b69648c | Andrew Gallant | 2014-09-24T01:01:56 | Add initial work on CSV indexing.
Regrettably, I had to pull in my own BufferedReader. There is assuredly
a cleaner solution (perhaps using unsafe). | diff --git a/src/buffered.rs b/src/buffered.rs
new file mode 100644
index 0000000..a69ce55
--- /dev/null
+++ b/src/buffered.rs
@@ -0,0 +1,72 @@
+use std::cmp;
+use std::io::{Reader, Buffer, IoResult};
+use std::slice;
+
+static DEFAULT_BUF_SIZE: uint = 1024 * 64;
+
+pub struct BufferedReader<R> {
+ inner: R,
+ bu... | 4 | 179 | 13 |
70a278d3e2efbe60f60cdab6197b5d7e50bf7317 | Andrew Gallant | 2014-09-22T00:01:14 | Update for latest Rust master. | diff --git a/src/decoder.rs b/src/decoder.rs
index 32956b7..8d67b96 100644
--- a/src/decoder.rs
+++ b/src/decoder.rs
@@ -22,14 +22,14 @@ pub struct Decoder<R> {
/// A CSV document's structure is simple (non-recursive).
enum Value {
Record(Vec<String>),
- String(String),
+ Field(String),
}
impl Value {
... | 1 | 9 | 9 |
512dd687b1587c2ff0ac224077dfabbf1eccf942 | Andrew Gallant | 2014-09-09T01:56:26 | A couple of tests. | diff --git a/src/test.rs b/src/test.rs
index 8d62b67..5e52836 100644
--- a/src/test.rs
+++ b/src/test.rs
@@ -143,6 +143,16 @@ fn decoder_same_length_records() {
}
}
+#[test]
+fn decoder_different_length_records() {
+ let mut d = Decoder::from_str("a\na,b")
+ .no_headers()
+ ... | 1 | 31 | 0 |
75375c1a2d2118418500963f9c2119c6875f9e65 | Andrew Gallant | 2014-09-09T01:56:16 | New crate alias syntax. | diff --git a/src/lib.rs b/src/lib.rs
index cc6c4a7..d65a10e 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -282,7 +282,7 @@
#[phase(plugin, link)] extern crate log;
extern crate rand;
extern crate serialize;
-extern crate stdtest = "test";
+extern crate "test" as stdtest;
#[cfg(test)]
extern crate quickcheck; | 1 | 1 | 1 |
f3d472265d3f3228a0e8dc85d6fc3dc47c26fd9c | Andrew Gallant | 2014-09-06T23:02:45 | Change the semantics of the `headers` method.
It will now always return the first record decoded, regardless of
whether `no_headers` is set or not. | diff --git a/src/decoder.rs b/src/decoder.rs
index 82fb822..32956b7 100644
--- a/src/decoder.rs
+++ b/src/decoder.rs
@@ -83,13 +83,14 @@ impl<R: Reader> Decoder<R> {
same_len: true,
first_len: 0,
no_headers: false,
- headers: vec!(),
+ fir... | 3 | 46 | 25 |
409a0e53c7d075de94336c2e3a6aacdc55f6ba0b | Andrew Gallant | 2014-09-06T20:06:58 | impl Equiv for ByteStrings against String and &str. | diff --git a/src/lib.rs b/src/lib.rs
index d5a7c6e..79a9619 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -337,6 +337,12 @@ impl ByteString {
chars
}
+ /// Returns this byte string as a slice of bytes.
+ pub fn as_bytes<'a>(&'a self) -> &'a [u8] {
+ let &ByteString(ref chars) = self;
+ ... | 1 | 12 | 0 |
e60b4a9d68e624ee39799eeeb21629393502c0bc | Andrew Gallant | 2014-09-06T20:02:29 | impl Hash for ByteString | diff --git a/src/lib.rs b/src/lib.rs
index 9a0a935..d5a7c6e 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -277,7 +277,7 @@
//!
//! Everything else should be supported, including new lines in quoted values.
-#![feature(phase)]
+#![feature(default_type_params, phase)]
#[phase(plugin, link)] extern crate log;
extern... | 1 | 8 | 1 |
31b938a23d24eac35af777fb2d6c564603e293c2 | Andrew Gallant | 2014-09-06T19:50:01 | Return an error for bad headers access.
If `headers` is called when `no_headers` was called on the
corresponding decoder, an error will be returned. (Previous
behavior was task failure.) | diff --git a/src/decoder.rs b/src/decoder.rs
index 16913c9..82fb822 100644
--- a/src/decoder.rs
+++ b/src/decoder.rs
@@ -210,17 +210,18 @@ impl<R: Reader> Decoder<R> {
/// Returns the header record for the underlying CSV data. This method may
/// be called repeatedly and at any time.
///
- /// If `no_... | 2 | 5 | 5 |
e4578ee616b046b1725fde3d2925766d8f9e64bc | Andrew Gallant | 2014-09-02T00:57:23 | version number bump | diff --git a/Cargo.toml b/Cargo.toml
index 35b47bf..3d5950d 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "rust-csv"
-version = "0.2.0"
+version = "0.2.1"
authors = ["Andrew Gallant <jamslam@gmail.com>"]
[lib] | 1 | 1 | 1 |
39840d4eb0d644e334a818d2a5e6d680ec0f4507 | Andrew Gallant | 2014-09-02T00:53:34 | Package name fixed.
It seems Cargo wants the package name to be the same as the repository
name. | diff --git a/Cargo.toml b/Cargo.toml
index db8e075..35b47bf 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,5 +1,5 @@
[package]
-name = "csv"
+name = "rust-csv"
version = "0.2.0"
authors = ["Andrew Gallant <jamslam@gmail.com>"] | 1 | 1 | 1 |
f7234986701e6c6f0377e02e3dc4cfaf18e38427 | Andrew Gallant | 2014-08-31T01:30:56 | Looks like decode_iter works again. | diff --git a/src/lib.rs b/src/lib.rs
index 07a53a3..6a4abdd 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -85,10 +85,10 @@
//!
//! An iterator is provided to repeat this for all records in the CSV data:
//!
+//! ```rust
//! ```
//! let mut rdr = csv::Decoder::from_str("andrew,1987\nkait,1989");
-//! let mut iter = r... | 2 | 4 | 7 |
9b600ba0740aa85e7d1aaaa7dedbaf91c7a7f922 | Andrew Gallant | 2014-08-02T02:03:31 | Add new `error` method for the `Decoder` trait. | diff --git a/src/lib.rs b/src/lib.rs
index 3bf6988..07a53a3 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1103,6 +1103,9 @@ impl<R: Reader> Decoder<R> {
}
impl<R: Reader> serialize::Decoder<Error> for Decoder<R> {
+ fn error(&mut self, err: &str) -> Error {
+ self.err(err)
+ }
fn read_nil(&mut self... | 1 | 3 | 0 |
be47cb82510fc5d8da59a9e032405400e3916f0b | Andrew Gallant | 2014-08-02T02:03:18 | This seems to be causing a weird crash in Cargo. | diff --git a/Cargo.toml b/Cargo.toml
index 8dbdf36..6d8a400 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -8,6 +8,6 @@ name = "csv"
path = "src/lib.rs"
crate_type = ["dylib", "rlib"]
-[dependencies.quickcheck]
-git = "git://github.com/BurntSushi/quickcheck"
+# [dependencies.quickcheck]
+# git = "git://github.com/Bur... | 1 | 2 | 2 |
bc6d84df5e5f5209dd7c09b8197ba33c48e4241d | Andrew Gallant | 2014-08-02T01:57:30 | Add crate type output. (Is it necessary? IDK.) | diff --git a/Cargo.toml b/Cargo.toml
index 48831b0..8dbdf36 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -6,6 +6,7 @@ authors = ["Andrew Gallant <jamslam@gmail.com>"]
[[lib]]
name = "csv"
path = "src/lib.rs"
+crate_type = ["dylib", "rlib"]
[dependencies.quickcheck]
git = "git://github.com/BurntSushi/quickcheck" | 1 | 1 | 0 |
295dbf8466882d1c3a6b44630643f35023c3c380 | Andrew Gallant | 2014-07-22T21:01:20 | Vector indexing is here. Woohoo. | diff --git a/src/lib.rs b/src/lib.rs
index 7ebf23f..3bf6988 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1124,7 +1124,7 @@ impl<R: Reader> serialize::Decoder<Error> for Decoder<R> {
return Err(self.err(format!(
"Expected single character but got '{}'.", s).as_slice()))
}
- ... | 1 | 1 | 1 |
1798350b965f078e02b4b82cf5b38055ded4579d | Andrew Gallant | 2014-06-27T01:35:20 | Attempting to bring up to date.
I can't get decode_iter to work properly. Type inference seems borked
somehow. Gah. | diff --git a/src/lib.rs b/src/lib.rs
index 3d109f8..d498634 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -87,19 +87,14 @@
//!
//! ```
//! let mut rdr = csv::Decoder::from_str("andrew,1987\nkait,1989");
-//! for (name, birth) in rdr.decode_iter::<(String, uint)>() {
+//! let mut iter = rdr.decode_iter::<(String, uint)... | 2 | 46 | 55 |
34b56fcdb18fa8373ced875e1d4ea0f6d0a93870 | Andrew Gallant | 2014-06-24T01:24:03 | Big changes to be compatible with new Rust.
There were apparently some serious changes made to the way
trait objects work. It's likely that my code was potentially
unsafe and only worked because of a bug in Rust.
In any case, it has been fixed. Fixing it resulted in removing
the StrEncoder type, which is quite nice I... | diff --git a/src/lib.rs b/src/lib.rs
index 1d1c9f8..3d109f8 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -281,10 +281,12 @@ extern crate quickcheck;
use std::default::Default;
use std::fmt;
use std::from_str::FromStr;
-use std::io::{BufferedReader};
-use std::io::{Reader, Writer};
-use std::io::{File, MemReader, MemW... | 2 | 129 | 159 |
3b75682e5e85ecd35712e431e26a6f258d37a2b5 | Brandon Waskiewicz | 2014-06-22T23:58:19 | Add some lifetime annotations | diff --git a/src/lib.rs b/src/lib.rs
index ef72c63..1d1c9f8 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -365,7 +365,7 @@ impl<'a> Encoder<'a> {
}
/// Creates an encoder that encodes CSV data with the `Writer` given.
- pub fn to_writer(w: &mut Writer) -> Encoder<'a> {
+ pub fn to_writer(w: &'a mut Writ... | 1 | 3 | 3 |
65e24945a55461fc310c2e57200416c75926774b | Andrew Gallant | 2014-06-16T02:59:52 | Looks like dead_code warnings got a bit more aggressive. Shut them down. | diff --git a/src/bench.rs b/src/bench.rs
index 04d2829..d1aff9d 100644
--- a/src/bench.rs
+++ b/src/bench.rs
@@ -49,6 +49,7 @@ fn large_raw_records(b: &mut Bencher) {
})
}
+#[allow(dead_code)]
#[deriving(Decodable)]
struct Play {
gameid: String, | 1 | 1 | 0 |
7d72a69e258f19dbfffee7b91a48c0c15106ff1b | Andrew Gallant | 2014-06-16T02:59:38 | syntax -> plugin | diff --git a/src/lib.rs b/src/lib.rs
index 7350ef4..ef72c63 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -270,7 +270,7 @@
#![feature(phase)]
-#[phase(syntax, link)] extern crate log;
+#[phase(plugin, link)] extern crate log;
extern crate rand;
extern crate serialize;
extern crate stdtest = "test"; | 1 | 1 | 1 |
cac25b4b2ffa3243a34c22555a1c4990f1ac5e96 | Andrew Gallant | 2014-06-10T16:05:41 | Support slurping up vectors in structs. Kind of hacky atm. Won't work
with tuples. | diff --git a/src/lib.rs b/src/lib.rs
index 44e05f2..7350ef4 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -869,6 +869,19 @@ enum Value {
String(String),
}
+impl Value {
+ fn is_record(&self) -> bool {
+ match *self {
+ Record(_) => true,
+ String(_) => false,
+ }
+ }
+
+ ... | 1 | 46 | 7 |
18f162f1614aeed88a7ec28ca8d9ac19aec61f93 | Andrew Gallant | 2014-06-04T02:07:11 | Update to work with latest Rust.
Mostly just to_{strbuf,owned} -> to_string. | diff --git a/src/lib.rs b/src/lib.rs
index 8c7f65c..44e05f2 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -47,9 +47,9 @@
//! let mut rdr = csv::Decoder::from_str("abc,xyz\n1,2");
//! rdr.has_headers(true);
//!
-//! assert_eq!(rdr.headers().unwrap(), vec!("abc".to_strbuf(), "xyz".to_strbuf()));
-//! assert_eq!(rdr.iter... | 2 | 27 | 27 |
ddd56bf7f7baa38085700a3c7a73bdeb9b0f3593 | Andrew Gallant | 2014-05-26T18:24:31 | Doc tests got complexified. Undo it. | diff --git a/src/lib.rs b/src/lib.rs
index 684e2aa..8c7f65c 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -47,12 +47,9 @@
//! let mut rdr = csv::Decoder::from_str("abc,xyz\n1,2");
//! rdr.has_headers(true);
//!
-//! assert_eq!(rdr.headers().unwrap().move_iter().map(|x| x.to_strbuf()).collect::<Vec<String>>(),
-//! ... | 1 | 5 | 10 |
898a7116153022259a892a37fa5219f7b2fe7303 | Brandon Waskiewicz | 2014-05-26T02:17:56 | Update docs
Convert vectors of boxed strings into vectors of StrBuf. | diff --git a/src/lib.rs b/src/lib.rs
index 6da52c2..63a99f0 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -46,10 +46,13 @@
//! ```
//! let mut rdr = csv::Decoder::from_str("abc,xyz\n1,2");
//! rdr.has_headers(true);
-//!
-//! assert_eq!(rdr.headers().unwrap(), vec!("abc".to_strbuf(), "xyz".to_strbuf()));
-//! assert_... | 1 | 12 | 7 |
d53559db8fb87f385bc1f9655a2798aedb47879c | Andrew Gallant | 2014-05-25T21:11:45 | Perf improvements.
Cleverly order the conditional testing so we avoid line
terminator checks (and peeking) in most cases. | diff --git a/src/lib.rs b/src/lib.rs
index 3ed3060..6da52c2 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -726,19 +726,21 @@ impl<'a> Parser<'a> {
let mut res = StrBuf::with_capacity(4);
loop {
try!(self.next_char());
- if self.is_lineterm() || self.is_eof() || self.is_sep() {
+ ... | 1 | 12 | 11 |
eeffeaf39c8c47d04ac64b1113af69e3a528118a | Andrew Gallant | 2014-05-18T16:06:21 | ~str -> StrBuf for tests. | diff --git a/src/bench.rs b/src/bench.rs
index 3f74490..ae343e1 100644
--- a/src/bench.rs
+++ b/src/bench.rs
@@ -51,16 +51,16 @@ fn large_raw_records(b: &mut Bencher) {
#[deriving(Decodable)]
struct Play {
- gameid: ~str,
+ gameid: StrBuf,
qtr: uint,
min: Option<uint>,
sec: Option<uint>,
- t... | 2 | 23 | 23 |
be7c7241633d13e6955c22a1866ee68a3d4cc671 | Andrew Gallant | 2014-05-18T15:43:08 | A hack to support StrBuf.
The real fix should probably be using StrBuf throughout the parser. | diff --git a/src/lib.rs b/src/lib.rs
index 97aafff..c5dd05f 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1147,8 +1147,8 @@ impl<'a> serialize::Decoder<Error> for Decoder<'a> {
}
Ok(*chars.get(0))
}
- fn read_str(&mut self) -> Result<~str, Error> {
- self.pop_string()
+ fn read_str(&m... | 1 | 2 | 2 |
146aee8e9b2f7c57c3e3421bc39f62bae8d747e6 | Andrew Gallant | 2014-05-18T15:42:36 | Update to work with Formatter changes. | diff --git a/src/lib.rs b/src/lib.rs
index 9ed0f66..97aafff 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -598,7 +598,7 @@ pub struct Error {
impl fmt::Show for Error {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
- write!(f.buf, "Parse error:{}:{}: {}", self.line, self.col, self.msg)
+ wr... | 1 | 1 | 1 |
0b37582da47fb29ade8291d0ee92eb0fd85e5e45 | Andrew Gallant | 2014-05-08T17:07:54 | Update to work with latest Rust. i.e., Remove old owned str syntax. | diff --git a/src/lib.rs b/src/lib.rs
index bba4953..6234a43 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -466,8 +466,8 @@ impl<'a> serialize::Encoder<~str> for Encoder<'a> {
match len {
0 => self.w(v_name),
1 => f(self),
- _ => Err(~"Cannot encode enum variants with more \
-... | 2 | 16 | 14 |
e7032f57c9cab26b8a106c5a38aae8b1b55d5792 | Andrew Gallant | 2014-04-12T17:07:52 | Update for latest Rust. | diff --git a/src/bench.rs b/src/bench.rs
index 1076e6d..3f74490 100644
--- a/src/bench.rs
+++ b/src/bench.rs
@@ -1,6 +1,6 @@
use std::fmt::Show;
use std::io;
-use stdtest::BenchHarness;
+use stdtest::Bencher;
use super::Decoder;
static CSV_SHORT: &'static str = "./examples/data/short.csv";
@@ -20,7 +20,7 @@ fn fi... | 2 | 11 | 13 |
0ed52e0540b33eba907e468af5dcfb3509bec9b8 | Andrew Gallant | 2014-04-10T19:11:07 | Update for Vec type for MemReader | diff --git a/src/lib.rs b/src/lib.rs
index bae3542..62d32b1 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -884,7 +884,7 @@ impl<'a> Decoder<'a> {
/// Creates a new CSV decoder that reads CSV data from the string given.
pub fn from_str(s: &str) -> Decoder<'a> {
- let r = MemReader::new(s.as_bytes().to_o... | 1 | 1 | 1 |
413767452b030e380daec13a0cb2d8e8c401b188 | Andrew Gallant | 2014-04-01T18:52:48 | Update to work with new visibility defaults. | diff --git a/src/lib.rs b/src/lib.rs
index ad0a656..bae3542 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -298,8 +298,8 @@ pub struct StrEncoder<'a> {
/// convenient since they call `fail!` on error. (Encoding to a string
/// isn't going to cause an IO error, but an error could be caused by
/// writing rec... | 1 | 11 | 11 |
20a4c606380722fc12d5acc1fcddc094679d3deb | Andrew Gallant | 2014-03-31T01:53:24 | Don't need macros any more. Woohoo! | diff --git a/src/lib.rs b/src/lib.rs
index 6a6fd20..ad0a656 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -267,7 +267,6 @@
//!
//! Everything else should be supported, including new lines in quoted values.
-#![feature(macro_rules)]
// Dunno what this is, but apparently it's required for the 'log' crate.
#![feature(... | 1 | 0 | 1 |
9749e245a1c33a302820d1482ea97e3d4231c130 | Andrew Gallant | 2014-03-31T01:38:38 | Update for the new Encoder/Decoder API. | diff --git a/src/lib.rs b/src/lib.rs
index 5b06955..6a6fd20 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1,7 +1,7 @@
-#[crate_id = "csv#0.1.0"];
-#[crate_type = "lib"];
-#[license = "UNLICENSE"];
-#[doc(html_root_url = "http://burntsushi.net/rustdoc/csv")];
+#![crate_id = "csv#0.1.0"]
+#![crate_type = "lib"]
+#![licens... | 1 | 194 | 178 |
52c64a46107a03e3bf45b03eb8bd2dc2dbd26db6 | Andrew Gallant | 2014-03-26T19:17:14 | Say something about the terrible decoding error handling. | diff --git a/src/lib.rs b/src/lib.rs
index d2ac6fd..5b06955 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1109,6 +1109,11 @@ impl<'a> Decoder<'a> {
}
}
+// The Decoder trait doesn't support error handling at all, yet it is important
+// not to crash the program when decoding bad CSV data.
+// Therefore, we attem... | 1 | 5 | 0 |
07869170777ca24d6c708c29a651b1ab55f3e953 | Andrew Gallant | 2014-03-26T18:42:37 | Kill the quickcheck tests until it's easier to install dependencies. | diff --git a/src/lib.rs b/src/lib.rs
index 90b3c21..d2ac6fd 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -3,7 +3,7 @@
#[license = "UNLICENSE"];
#[doc(html_root_url = "http://burntsushi.net/rustdoc/csv")];
-//! This crate provides a *streaming* CSV (comma separated values) encoder and
+//! This crate provides a stre... | 2 | 46 | 46 |
d79ce145b57ce9abee669ad1229e9277aa4a11ce | Andrew Gallant | 2014-03-26T05:59:13 | Docs are nearly complete I think. | diff --git a/src/lib.rs b/src/lib.rs
index 93916df..90b3c21 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -3,8 +3,9 @@
#[license = "UNLICENSE"];
#[doc(html_root_url = "http://burntsushi.net/rustdoc/csv")];
-//! This crate provides a CSV (comma separated values) encoder and decoder that
-//! works with the `Encoder` ... | 1 | 85 | 9 |
883194dd9c4387eed6276a8cae1b7d4c0b7a74f6 | Andrew Gallant | 2014-03-26T00:14:12 | Moved tests to their own file. | diff --git a/src/lib.rs b/src/lib.rs
index bfb14cf..f3560e5 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -903,228 +903,4 @@ fn to_lower(s: &str) -> ~str {
mod bench;
#[cfg(test)]
-mod test {
- use quickcheck::{TestResult, quickcheck};
- use super::{StrEncoder, Decoder};
-
- #[deriving(Show, Encodable, Decod... | 2 | 224 | 225 |
bd92710b8f5b56f27cf8b9f61724ced84f0b66aa | Andrew Gallant | 2014-03-25T01:28:44 | Support for Enum variants of one argument. | diff --git a/examples/nfl_plays.rs b/examples/nfl_plays.rs
new file mode 100644
index 0000000..19c58b8
--- /dev/null
+++ b/examples/nfl_plays.rs
@@ -0,0 +1,41 @@
+extern crate csv;
+extern crate serialize;
+
+use std::path::Path;
+use csv::Decoder;
+
+#[deriving(Decodable)]
+struct Play {
+ gameid: ~str,
+ qtr: u... | 2 | 143 | 28 |
e567a2db0546c66205c7581c49178e9ca7adc2ee | Andrew Gallant | 2014-03-24T17:32:32 | My tuple bug was fixed, so explicitly delegate encoding/decoding
tuples as sequences. | diff --git a/src/lib.rs b/src/lib.rs
index a70a517..2e5daf1 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -231,11 +231,11 @@ impl<'a> serialize::Encoder for Encoder<'a> {
f: |&mut Encoder<'a>|) {
self.emit_seq_elt(f_idx, f)
}
- fn emit_tuple(&mut self, _: uint, _: |&mut Encoder<... | 1 | 8 | 8 |
4c276681653fdaa638d1a4cdff21ae8033d5f67d | Andrew Gallant | 2014-03-24T17:32:10 | Add test for decoding headers. | diff --git a/src/lib.rs b/src/lib.rs
index 4e2e596..a70a517 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -998,6 +998,16 @@ mod test {
}
}
+ #[test]
+ fn decoder_headers() {
+ let mut d = Decoder::from_str("a,b,c\n1,2,3");
+ d.has_headers(true);
+ assert_eq!(d.headers().unwrap()... | 1 | 10 | 0 |
fe528f3b1ac8b2737c86bce68a8e5ea1b4d5184e | Andrew Gallant | 2014-03-24T17:31:57 | Iterator::to_owned_vec is no more. | diff --git a/src/lib.rs b/src/lib.rs
index 1c5019e..4e2e596 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -732,7 +732,7 @@ impl<'a> serialize::Decoder for Decoder<'a> {
fn read_f32(&mut self) -> f32 { dectry!(self.pop_from_str(), 0.0) }
fn read_char(&mut self) -> char {
let s = dectry!(self.pop_string(... | 1 | 1 | 1 |
9493f564a92cb416515fc667bbc7d1407dd20cb0 | Andrew Gallant | 2014-03-24T05:04:52 | Be less forgiving for contract violations. | diff --git a/src/lib.rs b/src/lib.rs
index 8393f32..dd9ffc6 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -620,10 +620,10 @@ impl<'a> Decoder<'a> {
/// be called repeatedly and at any time.
///
/// If `has_headers` is `false` (which is the default), then this will
- /// always return an empty vector.
+ ... | 1 | 10 | 2 |
f702c67aea84f9b491845a6779ade2e9aca989ff | Andrew Gallant | 2014-03-24T04:59:11 | Bad error handling is a thing of the past. | diff --git a/src/lib.rs b/src/lib.rs
index 650e061..5dc0b32 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -577,7 +577,7 @@ impl<'a> Decoder<'a> {
}
/// Calls `decode` on every record in the CSV data until EOF and returns
- /// them as a vector. (Sorry, hopefully this will change at some point.)
+ /// th... | 1 | 1 | 1 |
5be72e13bb4ad05f6cf341604108161d84dd48de | Andrew Gallant | 2014-03-24T04:57:14 | Property based testing caught a nasty bug where empty lines
were interpreted as records. | diff --git a/src/lib.rs b/src/lib.rs
index 9c2b6c5..650e061 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -11,6 +11,7 @@
#[feature(phase)];
#[phase(syntax, link)] extern crate log;
+extern crate quickcheck;
extern crate rand;
extern crate serialize;
@@ -60,15 +61,15 @@ pub struct StrEncoder<'a> {
/// isn't g... | 1 | 91 | 43 |
41d9dce44915179354943e44d63b6c35c101d8b3 | Andrew Gallant | 2014-03-24T01:32:52 | Decoding now reports errors. Tests. | diff --git a/src/lib.rs b/src/lib.rs
index 98b5211..9c2b6c5 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1,7 +1,7 @@
#[crate_id = "csv#0.1.0"];
#[crate_type = "lib"];
#[license = "UNLICENSE"];
-#[doc(html_root_url = "http://burntsushi.net/rustdoc/rust-csv")];
+#[doc(html_root_url = "http://burntsushi.net/rustdoc/csv... | 1 | 249 | 129 |
09be054a5a36207e859f78835dedaaa5140ab6e9 | Andrew Gallant | 2014-03-23T18:25:19 | Small reogranization. Group type definitions with their impls. | diff --git a/src/lib.rs b/src/lib.rs
index acc38ed..98b5211 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -38,6 +38,229 @@ macro_rules! enctry(
)
)
+/// A convenience encoder for encoding CSV data to strings.
+pub struct StrEncoder<'a> {
+ /// The underlying Encoder. Options like the separator, line endings an... | 1 | 225 | 224 |
d3b0cde8cb9bcd1595c83b6f2492b9694c87150c | Andrew Gallant | 2014-03-23T18:21:10 | Fix unused variable warnings. | diff --git a/src/lib.rs b/src/lib.rs
index e51359b..acc38ed 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -3,9 +3,6 @@
#[license = "UNLICENSE"];
#[doc(html_root_url = "http://burntsushi.net/rustdoc/rust-csv")];
-#[allow(dead_code)];
-#[allow(unused_variable)];
-
//! This crate provides a CSV encoder and decoder that... | 1 | 244 | 248 |
097dd1ee23501af727e3a029b2030da284da527b | Andrew Gallant | 2014-03-23T04:39:34 | use the new Vec type | diff --git a/src/lib.rs b/src/lib.rs
index 9f89f57..e51359b 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -2,7 +2,6 @@
#[crate_type = "lib"];
#[license = "UNLICENSE"];
#[doc(html_root_url = "http://burntsushi.net/rustdoc/rust-csv")];
-#[allow(deprecated_owned_vector)];
#[allow(dead_code)];
#[allow(unused_variable)... | 1 | 30 | 31 |
8a5fed9187f0483924ca0d7b99fc10c823afd3ab | Alexander 'z33ky' Hirsch | 2023-02-22T14:20:56 | Constify FormatSizeOptions | diff --git a/src/options/mod.rs b/src/options/mod.rs
index 4f09627..646289f 100644
--- a/src/options/mod.rs
+++ b/src/options/mod.rs
@@ -119,51 +119,51 @@ pub struct FormatSizeOptions {
}
impl FormatSizeOptions {
- pub fn from(from: FormatSizeOptions) -> FormatSizeOptions {
+ pub const fn from(from: FormatSiz... | 2 | 77 | 61 |
5be26cd841d216ba148fc9fbcf72b54adda18ca1 | LeopoldArkham | 2022-12-31T12:30:01 | Bump version | diff --git a/Cargo.toml b/Cargo.toml
index afae73d..e7edaaa 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "humansize"
-version = "2.1.2"
+version = "2.1.3"
authors = ["Leopold Arkham <leopold.arkham@gmail.com>"]
edition = "2021"
readme = "README.md" | 1 | 1 | 1 |
1698b94be7de2a78f7c481c6c14c28950af8e6ae | LeopoldArkham | 2022-11-16T10:50:37 | Bump version | diff --git a/Cargo.toml b/Cargo.toml
index 24aff1e..4036656 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "humansize"
-version = "2.1.0"
+version = "2.1.1"
authors = ["Leopold Arkham <leopold.arkham@gmail.com>"]
edition = "2021"
readme = "README.md" | 1 | 1 | 1 |
759ac54577159407c65d44a06143267b7e9ef8fd | LeopoldArkham | 2022-11-16T10:39:48 | Impl ToF64 for f32 and f64 | diff --git a/src/numeric_traits.rs b/src/numeric_traits.rs
index 8b01008..7cf744b 100644
--- a/src/numeric_traits.rs
+++ b/src/numeric_traits.rs
@@ -12,7 +12,7 @@ macro_rules! impl_to_f64 {
)*)
}
-impl_to_f64!(for usize u8 u16 u32 u64 isize i8 i16 i32 i64);
+impl_to_f64!(for usize u8 u16 u32 u64 isize i8 i16 i32 ... | 2 | 5 | 1 |
8b6903f3e34cd8bfb058d42f6510b880b70fbd9d | LeopoldArkham | 2022-10-05T13:07:59 | bump version | diff --git a/Cargo.toml b/Cargo.toml
index 6836f6a..3aa288c 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "humansize"
-version = "2.0.0"
+version = "2.1.0"
authors = ["Leopold Arkham <leopold.arkham@gmail.com>"]
edition = "2021"
readme = "README.md" | 1 | 1 | 1 |
c53cd5a7ad1081bf8ed5007f9ba58a35e1af004b | LeopoldArkham | 2022-10-05T13:07:09 | exclude feature tests from published bundle | diff --git a/Cargo.toml b/Cargo.toml
index db89917..6836f6a 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -11,6 +11,7 @@ documentation = "https://docs.rs/humansize"
keywords = ["size", "formatting", "humanize", "file-size"]
categories = ["value-formatting"]
license = "MIT/Apache-2.0"
+exclude = ["/feature-tests"]
... | 1 | 1 | 0 |
38943dc0b1001c995975737ec8ebdba5000ac7c2 | LeopoldArkham | 2022-10-05T12:43:20 | fix struct name error | diff --git a/examples/sizes.rs b/examples/sizes.rs
index a425c95..cd25a7c 100644
--- a/examples/sizes.rs
+++ b/examples/sizes.rs
@@ -1,6 +1,6 @@
extern crate humansize;
-use humansize::{format_size, format_size_i, Formatter, IFormatter, BINARY, DECIMAL, WINDOWS};
+use humansize::{format_size, format_size_i, SizeForm... | 6 | 26 | 26 |
44802b23bb358f16f4764a0c08ae478554ddab66 | LeopoldArkham | 2022-08-29T13:00:40 | rename traits.rs | diff --git a/src/allocating.rs b/src/allocating.rs
index edecd9e..6c9b9f6 100644
--- a/src/allocating.rs
+++ b/src/allocating.rs
@@ -1,7 +1,7 @@
use alloc::string::String;
use crate::options::FormatSizeOptions;
-use crate::traits::*;
+use crate::numeric_traits::*;
use crate::IFormatter;
pub fn format_size_i(inp... | 3 | 3 | 3 |
93a8a5572dd37efc3e3235e36fbd832fffa95134 | LeopoldArkham | 2022-08-26T20:50:17 | Clippy auto fix | diff --git a/examples/sizes.rs b/examples/sizes.rs
index 7e33a44..05b2c9f 100644
--- a/examples/sizes.rs
+++ b/examples/sizes.rs
@@ -8,6 +8,6 @@ fn main() {
println!("{}", format_size(5456usize, BINARY));
println!("{}", format_size(1024usize, BINARY));
println!("{}", format_size(1000usize, DECIMAL));
- ... | 3 | 3 | 3 |
a6614fa02c0d5ff68906b1b95fa02021cc81f142 | LeopoldArkham | 2022-08-14T13:55:26 | Add std-compatible error type | diff --git a/src/lib.rs b/src/lib.rs
index 0fd7d17..8ceb70f 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -33,9 +33,25 @@ If you wish to customize the way sizes are displayed, you may create your own cu
and pass that to the method. See the `custom_options.rs` file in the example folder.
*/
+use std::error::Error;
+us... | 1 | 21 | 4 |
921bb666da8239426978a6a1e03b9b3974a6da8c | LeopoldArkham | 2022-08-13T16:58:14 | Fix redundant module | diff --git a/src/lib.rs b/src/lib.rs
index 32a93a0..0fd7d17 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1,149 +1,40 @@
-//! # **Humansize**
-//!
-//! Humansize lets you easily represent file sizes in a human-friendly format.
-//! You can specify your own formatting style, pick among the three defaults provided
-//! by... | 1 | 34 | 143 |
14c2859718c3bbebeb3e537f34ad40d355829f3d | LeopoldArkham | 2022-08-13T16:57:55 | Comply with SI for kilobyte | diff --git a/src/scales.rs b/src/scales.rs
index bc45c65..e2e655b 100644
--- a/src/scales.rs
+++ b/src/scales.rs
@@ -1,4 +1,4 @@
-pub(crate) static SCALE_DECIMAL: [&str; 9] = ["B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"];
+pub(crate) static SCALE_DECIMAL: [&str; 9] = ["B", "kB", "MB", "GB", "TB", "PB", "EB", "Z... | 1 | 1 | 1 |
ef0dc80f16bc2802e376bcdadd7d0b46f1bf16de | Josh Triplett | 2021-10-31T11:50:48 | Re-export `FileSizeOpts` and default option sets at the top level
The humansize crate has relatively few types and constants; make the
most commonly used ones available at the top level for convenience. | diff --git a/src/lib.rs b/src/lib.rs
index 8907398..3676e08 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -16,15 +16,15 @@
//!
//! ```rust
//! extern crate humansize;
-//! use humansize::{FileSize, file_size_opts as options};
+//! use humansize::FileSize;
//!
//! fn main() {
//! let size = 1000;
-//! println!("Si... | 1 | 28 | 27 |
d8a898be942a9cb0131dd520dc38fe93c26629af | Josh Triplett | 2021-10-31T11:43:24 | Fix typo: s/providedby/provided by/ | diff --git a/src/lib.rs b/src/lib.rs
index aafb841..b8b5f38 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -157,7 +157,7 @@ pub mod file_size_opts {
/// The trait for the `file_size`method
pub trait FileSize {
/// Formats self according to the parameters in `opts`. `opts` can either be one of the
- /// three def... | 1 | 1 | 1 |
7c6837cd726ba0714786356b6d97b90bf676be4a | Josh Triplett | 2021-10-31T11:36:30 | Fix typo: s/abbreveation/abbreviation/ | diff --git a/src/lib.rs b/src/lib.rs
index 8907398..aafb841 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -98,7 +98,7 @@ pub mod file_size_opts {
pub decimal_zeroes: usize,
/// Whether to force a certain representation and if so, which one.
pub fixed_at: FixedAt,
- /// Whether to use the... | 1 | 1 | 1 |
0f26b06bccd742c60a6206f4e311e82e79822824 | LeopoldArkham | 2021-05-20T16:28:42 | Add homepage and readme | diff --git a/Cargo.toml b/Cargo.toml
index 0285ad7..d6e50c1 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -2,12 +2,11 @@
name = "humansize"
version = "1.1.1"
authors = ["Leopold Arkham <leopold.arkham@gmail.com>"]
-
+readme = "README.md"
description = "A configurable crate to easily represent file sizes in a hum... | 1 | 3 | 4 |
9ca8feeb14aa4eaa7a5e3a70a95b9d9841820a5b | LeopoldArkham | 2019-12-15T18:39:36 | cargo fmt | diff --git a/src/file_size_opts/defaults.rs b/src/file_size_opts/defaults.rs
index 9d212ed..8860c44 100644
--- a/src/file_size_opts/defaults.rs
+++ b/src/file_size_opts/defaults.rs
@@ -1,9 +1,4 @@
-use crate::file_size_opts::{
- FileSizeOpts,
- Kilo,
- FixedAt,
-};
-
+use crate::file_size_opts::{FileSizeOpts, FixedA... | 5 | 19 | 81 |
cc8878d122bc3d75071dee9ccec542169fea2234 | LeopoldArkham | 2019-11-24T17:12:06 | Add tests | diff --git a/tests/test.rs b/tests/test.rs
index 42911f0..dc1329d 100644
--- a/tests/test.rs
+++ b/tests/test.rs
@@ -65,4 +65,98 @@ fn test_sizes() {
"-5.50 KB"
);
assert_eq!((5500).file_size(&semi_custom_options7).unwrap(), "5.50 KB");
+}
+
+
+#[test]
+fn use_custom_option_struct_twice() {
+ let ... | 1 | 94 | 0 |
1b01971b91d66abb61634c79806f411c83a6949e | LeopoldArkham | 2019-10-27T01:09:40 | Move tests and bump to 2018 edition | diff --git a/Cargo.toml b/Cargo.toml
index 0285ad7..c4eacd4 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -2,6 +2,7 @@
name = "humansize"
version = "1.1.1"
authors = ["Leopold Arkham <leopold.arkham@gmail.com>"]
+edition = "2018"
description = "A configurable crate to easily represent file sizes in a human-rea... | 4 | 4 | 3 |
d8d76060c283edd59b4c8b78a47c67a8c149751f | LeopoldArkham | 2019-10-27T01:04:24 | WIP split files | diff --git a/src/file_size_opts/defaults.rs b/src/file_size_opts/defaults.rs
new file mode 100644
index 0000000..925f7f6
--- /dev/null
+++ b/src/file_size_opts/defaults.rs
@@ -0,0 +1,48 @@
+use file_size_opts::{
+ FileSizeOpts,
+ Kilo,
+ FixedAt,
+};
+
+
+/// Options to display sizes in the binary format.
+pub const... | 4 | 189 | 178 |
89e9b0cf5050e5cfd08bfa6cf2a54cad73ab2113 | LeopoldArkham | 2019-10-26T20:21:30 | Move scales to their own file | diff --git a/src/lib.rs b/src/lib.rs
index 216d71e..c339fd9 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -31,31 +31,7 @@
//! If you wish to customize the way sizes are displayed, you may create your own custom `FileSizeOpts` struct
//! and pass that to the method. See the `custom_options.rs` file in the example folder... | 2 | 55 | 29 |
f0ced31147e84f1295a539d3b8dc434298ddd609 | LeopoldArkham | 2019-10-26T17:36:55 | conflicts | diff --git a/src/lib.rs b/src/lib.rs
index 1a0b2dd..216d71e 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -31,26 +31,8 @@
//! If you wish to customize the way sizes are displayed, you may create your own custom `FileSizeOpts` struct
//! and pass that to the method. See the `custom_options.rs` file in the example folder... | 1 | 0 | 56 |
7a4eaad5bf30339d6b2b6baecf43439d096fb147 | LeopoldArkham | 2019-10-25T20:34:13 | Custom f64 equality function | diff --git a/src/lib.rs b/src/lib.rs
index 95944c6..08bfc64 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -31,8 +31,8 @@
//! If you wish to customize the way sizes are displayed, you may create your own custom `FileSizeOpts` struct
//! and pass that to the method. See the `custom_options.rs` file in the example folder.... | 1 | 36 | 34 |
15768b466ccb5d5dc8eee2df30f7a207db4caf8e | LeopoldArkham | 2019-10-25T17:18:42 | Bump version | diff --git a/Cargo.toml b/Cargo.toml
index 89167f0..3e1b9f1 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "humansize"
-version = "1.1.0"
+version = "1.1.1"
authors = ["Leopold Arkham <leopold.arkham@gmail.com>"]
description = "A configurable crate to easily represent file sizes in a... | 1 | 1 | 1 |
677be572e60d7d1b2a9b9ff8de1d462193a5d3d2 | LeopoldArkham | 2019-10-20T17:10:17 | Spacing and formatting | diff --git a/src/lib.rs b/src/lib.rs
index 445061e..2bc1b0a 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -31,7 +31,20 @@
//! If you wish to customize the way sizes are displayed, you may create your own custom `FileSizeOpts` struct
//! and pass that to the method. See the `custom_options.rs` file in the example folder... | 1 | 47 | 3 |
aafbd4efec4cd80f237a6edd3285feec227db25a | LeopoldArkham | 2019-10-20T16:38:19 | convert tabs to spaces | diff --git a/src/lib.rs b/src/lib.rs
index 52847c2..83ddc03 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -182,17 +182,17 @@ use self::file_size_opts::*;
macro_rules! impl_file_size_u {
(for $($t:ty)*) => ($(
impl FileSize for $t {
- fn file_size<T: AsRef<FileSizeOpts>>(&self, _opts: T) -> Result<S... | 1 | 29 | 29 |
04fe6878d8ae407ad33ae8e2e76d6df30cb50ea6 | Leopold Arkham | 2017-12-23T18:51:30 | Version bump | diff --git a/Cargo.toml b/Cargo.toml
index 8823415..89167f0 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,10 +1,10 @@
[package]
name = "humansize"
-version = "1.0.2"
+version = "1.1.0"
authors = ["Leopold Arkham <leopold.arkham@gmail.com>"]
description = "A configurable crate to easily represent file sizes in... | 1 | 2 | 2 |
e89c7dd86329727d5fd4686bbbd385e006a808fb | Leopold Arkham | 2017-12-23T18:44:22 | Allow negative input, rustfmt | diff --git a/examples/custom_options.rs b/examples/custom_options.rs
index a5e923e..abd37a1 100644
--- a/examples/custom_options.rs
+++ b/examples/custom_options.rs
@@ -1,24 +1,28 @@
-extern crate humansize;
-use humansize::{FileSize, file_size_opts as opts};
-
-fn main() {
- // Declare a fully custom option str... | 3 | 139 | 77 |
f45f9c1ebdce74d2b95a19877f62968462bec81e | Unknown | 2017-11-22T19:30:17 | Fix test, fix compiler warning, correct typo | diff --git a/src/lib.rs b/src/lib.rs
index 1aa4b20..039ed5c 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -90,9 +90,9 @@ pub mod file_size_opts {
pub divider: Kilo,
/// The unit set to use.
pub units: Kilo,
- /// The amount of places if the decimal part is non-zero.
+ /// The amou... | 1 | 12 | 14 |
01e4d2ace9875f88a2f911797d27a85b69b701b1 | Unknown | 2017-11-22T19:29:16 | Bump version | diff --git a/Cargo.toml b/Cargo.toml
index 4a5d8a2..8823415 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "humansize"
-version = "1.0.1"
+version = "1.0.2"
authors = ["Leopold Arkham <leopold.arkham@gmail.com>"]
description = "A configurable crate to easily represent file sizes in a... | 1 | 1 | 1 |
d7b2f5eaa6b6e476fc98b186c786f41d22efa53d | LeopoldArkham | 2017-03-15T19:42:55 | Bump for categories | diff --git a/Cargo.toml b/Cargo.toml
index 3d9c0d7..4a5d8a2 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "humansize"
-version = "1.0.0"
+version = "1.0.1"
authors = ["Leopold Arkham <leopold.arkham@gmail.com>"]
description = "A configurable crate to easily represent file sizes in a... | 1 | 1 | 1 |
e8fbc5d5741e2840d9d5de43c6e657f690bbf26e | Jake Goulding | 2017-01-20T19:03:00 | Add categories to Cargo.toml | diff --git a/Cargo.toml b/Cargo.toml
index 5e6f09e..3d9c0d7 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -5,7 +5,8 @@ authors = ["Leopold Arkham <leopold.arkham@gmail.com>"]
description = "A configurable crate to easily represent file sizes in a human-readable format."
repository = "https://github.com/LeopoldArkham/h... | 1 | 3 | 2 |
b8108d245b68ea23a40626c1476bb4f8b4fe6f7f | arkham | 2017-01-17T22:14:33 | keywords | diff --git a/Cargo.toml b/Cargo.toml
index 5e6f09e..1afac78 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -5,7 +5,7 @@ authors = ["Leopold Arkham <leopold.arkham@gmail.com>"]
description = "A configurable crate to easily represent file sizes in a human-readable format."
repository = "https://github.com/LeopoldArkham/h... | 1 | 1 | 1 |
01e262cc8ffe4bcd79d2d107ee96d0ccfd22b23a | arkham | 2017-01-17T21:55:20 | Bump to 1.0.0 | diff --git a/Cargo.toml b/Cargo.toml
index d72e065..5e6f09e 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,11 +1,11 @@
[package]
name = "humansize"
-version = "0.1.1"
+version = "1.0.0"
authors = ["Leopold Arkham <leopold.arkham@gmail.com>"]
-description = "A crate to easily represent file sizes in a human-read... | 1 | 4 | 4 |
fe76f9a68b53cd17f643d2d9ef9b45aab6d79ba1 | LeopoldArkham | 2017-01-12T23:17:28 | Started adding fixed | diff --git a/src/lib.rs b/src/lib.rs
index ba24ce1..95dc6cd 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -3,7 +3,7 @@
//! Humansize lets you easily represent file sizes in a human-friendly format.
//! You can specify your own formatting style, pick among the three defaults provided
//! by the library:
-//!
+//!
//!... | 1 | 91 | 60 |
717cabab31816a467a1699b5f3ff7a1a7996173a | Markas Cerniauskas | 2017-01-03T15:57:59 | 2 more tests | diff --git a/src/lib.rs b/src/lib.rs
index 59a9cfc..4f05ed7 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -194,6 +194,13 @@ fn test_sizes() {
assert_eq!(1023.file_size(DECIMAL).unwrap(), "1.02 KB");
assert_eq!(1024.file_size(BINARY).unwrap(), "1 KiB");
assert_eq!(1024.file_size(CONVENTIONAL).unwrap(), "1 KB");
+
... | 1 | 7 | 0 |
b2dd2fb3acba0bcc6405aed51e3202546bfc43ec | Markas Cerniauskas | 2017-01-03T15:21:16 | Suffixes and custom_options update | diff --git a/examples/custom_options.rs b/examples/custom_options.rs
index 0071ea3..ea58f09 100644
--- a/examples/custom_options.rs
+++ b/examples/custom_options.rs
@@ -8,7 +8,9 @@ fn main() {
units: opts::Standard::Decimal,
decimal_places: 3,
decimal_zeroes: 1,
- long_suffix: true
+ long_suffix: true,
+ sp... | 2 | 15 | 8 |
573b02ae0251e5fbed8f6a573c909f0d91ac33df | sakram07 | 2017-01-03T15:07:24 | Another whether
Holy crap, I just keep missing things | diff --git a/src/lib.rs b/src/lib.rs
index 0f3824d..6008e22 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -62,7 +62,7 @@ pub mod file_size_opts {
pub decimal_places: usize,
/// The amount of zeroes to display of the decimal part is zero.
pub decimal_zeroes: usize,
- /// Wether to use the... | 1 | 1 | 1 |
7a51c38fe948a505d1c57901826b1d5f209ae5c5 | sakram07 | 2017-01-03T15:05:21 | Semicolon | diff --git a/src/lib.rs b/src/lib.rs
index ed6f51d..0f3824d 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -155,7 +155,7 @@ macro_rules! impl_file_size_u {
let space = match opts.space {
true => " ",
false => ""
- }
+ };
Ok(format!("{:.*}{}{}", places, size, space, scale))
} | 1 | 1 | 1 |
218a42e025c3fe0c489b45ef9c5c4920f894c92c | sakram07 | 2017-01-03T15:02:34 | Changed string allocation and misspelling | diff --git a/src/lib.rs b/src/lib.rs
index 2a1b60d..ed6f51d 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -64,7 +64,7 @@ pub mod file_size_opts {
pub decimal_zeroes: usize,
/// Wether to use the full suffix or its abbreveation.
pub long_suffix: bool,
- /// Wether to place a space between... | 1 | 6 | 6 |
ae1ddc7d4bc4e0a1c8dc38fff8c30803238c6870 | Markas Cerniauskas | 2017-01-03T11:01:57 | Added space option and wrote a test for it | diff --git a/src/lib.rs b/src/lib.rs
index ba24ce1..2a1b60d 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -3,7 +3,7 @@
//! Humansize lets you easily represent file sizes in a human-friendly format.
//! You can specify your own formatting style, pick among the three defaults provided
//! by the library:
-//!
+//!
//!... | 1 | 28 | 16 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.