changed project name to 'bincode'

This commit is contained in:
Ty Overby 2014-10-27 09:45:24 -07:00
parent a8edf6cdfd
commit ed96883a53
6 changed files with 41 additions and 14 deletions

View File

@ -1,4 +1,4 @@
[package]
name = "binary_encode"
name = "bincode"
version = "0.0.1"
authors = ["Ty Overby <ty@pre-alpha.com>"]

View File

@ -1,23 +1,23 @@
# Binary Encoder / Decoder
[![Build Status](https://travis-ci.org/TyOverby/binary-encode.svg)](https://travis-ci.org/TyOverby/binary-encode)
[![Build Status](https://travis-ci.org/TyOverby/bincode.svg)](https://travis-ci.org/TyOverby/bincode)
A compact encoder / decoder pair that uses an binary zero-fluff encoding scheme.
The size of the encoded object will be the same or smaller than the size that
the object takes up in memory in a running Rust program.
In addition to exposing two simple funcitons that encode to `Vec<u8>` and decode
from `Vec<u8>`, binary-encode exposes a Reader/Writer API that makes it work
In addition to exposing two simple funcitons that encode to Vec<u8> and decode
from Vec<u8>, binary-encode exposes a Reader/Writer API that makes it work
perfectly with other stream-based apis such as rust files, network streams,
and the [flate2-rs](https://github.com/alexcrichton/flate2-rs) compression
library.
[Api Documentation](http://tyoverby.github.io/binary-encode/binary_encode/)
[Api Documentation](http://tyoverby.github.io/bincode/bincode/)
## Example
```rust
extern crate binary_encode;
extern crate bincode;
extern crate serialize;
#[deriving(Encodable, Decodable, PartialEq)]
@ -36,8 +36,8 @@ fn main() {
entities: vec![Entity {x: 0.0, y: 4.0}, Entity {x: 10.0, y: 20.5}]
};
let encoded: Vec<u8> = binary_encode::encode(&world).unwrap();
let decoded: World = binary_encode::decode(encoded).unwrap();
let encoded: Vec<u8> = bincode::encode(&world).unwrap();
let decoded: World = bincode::decode(encoded).unwrap();
assert!(world == decoded);
}

View File

@ -1,4 +1,4 @@
extern crate binary_encode;
extern crate bincode;
extern crate serialize;
#[deriving(Encodable, Decodable, PartialEq)]
@ -17,8 +17,8 @@ fn main() {
entities: vec![Entity {x: 0.0, y: 4.0}, Entity {x: 10.0, y: 20.5}]
};
let encoded: Vec<u8> = binary_encode::encode(&world).unwrap();
let decoded: World = binary_encode::decode(encoded).unwrap();
let encoded: Vec<u8> = bincode::encode(&world).unwrap();
let decoded: World = bincode::decode(encoded).unwrap();
assert!(world == decoded);
}

21
examples/file.rs Normal file
View File

@ -0,0 +1,21 @@
extern crate bincode;
extern crate serialize;
use std::collections::HashMap;
use std::io::{Truncate, ReadWrite, File, BufferedReader};
fn main() {
let mut word_counts = HashMap::new();
word_counts.insert("foo".to_string(), 3u);
word_counts.insert("fizzbuzz".to_string(), 8u);
let file = File::open_mode(&Path::new("store.bin"), Truncate, ReadWrite);
let mut file = file.unwrap();
bincode::encode_into(&word_counts, &mut file);
file.fsync().unwrap();
let out: HashMap<String, uint> =
bincode::decode_from(&mut BufferedReader::new(file)).unwrap();
assert!(out == word_counts);
}

View File

@ -1,12 +1,18 @@
# Binary Encoder / Decoder
[![Build Status](https://travis-ci.org/TyOverby/binary-encode.svg)](https://travis-ci.org/TyOverby/binary-encode)
[![Build Status](https://travis-ci.org/TyOverby/bincode.svg)](https://travis-ci.org/TyOverby/bincode)
A compact encoder / decoder pair that uses an binary zero-fluff encoding scheme.
The size of the encoded object will be the same or smaller than the size that
the object takes up in memory in a running Rust program.
[Api Documentation](http://tyoverby.github.io/binary-encode/binary_encode/)
In addition to exposing two simple funcitons that encode to Vec<u8> and decode
from Vec<u8>, binary-encode exposes a Reader/Writer API that makes it work
perfectly with other stream-based apis such as rust files, network streams,
and the [flate2-rs](https://github.com/alexcrichton/flate2-rs) compression
library.
[Api Documentation](http://tyoverby.github.io/bincode/bincode/)
## Example

View File

@ -1,4 +1,4 @@
#![crate_name = "binary_encode"]
#![crate_name = "bincode"]
#![crate_type = "rlib"]
#![crate_type = "dylib"]