Comments (5)
I updated rust to newest nightly (0.12->0.13) and reran this, now getting a new error. I'm on Windows..
Compiling msgpack v0.0.1 (https://github.com/mneumann/rust-msgpack.git#cc990f56)
C:\Users\chris\.cargo\git\checkouts\rust-msgpack-437ef857d42dd556\master\src\lib.rs:96:18: 96:20 error: expected `=>`, found `..`
C:\Users\chris\.cargo\git\checkouts\rust-msgpack-437ef857d42dd556\master\src\lib.rs:96 0x00 .. 0x7f => Ok(c as u64),
^~
Could not compile `msgpack`.
from rust-msgpack.
@viperscape Make sure you update the library version. If you're using cargo, you can run cargo update
.
from rust-msgpack.
okay, reran this cleanly and got same original error:
task '<main>' failed at 'called `Option::unwrap()` on a `None` value', /home/rustbuild/src/rust-buildbot/slave/nightly-linux/build/src/libcore/option.rs:347
An unknown error occurred
from rust-msgpack.
@viperscape from_msgpack
doesn't return a Value
object but a T
. unwrap
is also extremely hard to debug things as it fails from within the Option
implementation.
Here's a working example:
extern crate serialize;
extern crate msgpack;
use std::io::IoError;
use std::io::IoResult;
#[deriving(Show, Encodable,Decodable)]
struct MyStruct {
a: Vec<u32>,
s: String
}
fn main() {
let m = MyStruct{ a: vec![1u32, 5], s: "hi".to_string()};
let enc = msgpack::Encoder::to_msgpack(&m).ok().unwrap();
println!("1: {}",&enc); //[130, 146, 1, 5, 162, 104, 105]
match msgpack::from_msgpack::<MyStruct>(enc) {
Ok(s) => println!("success: {}", s),
Err(err) => fail!("Error: {}", err)
}
}
from rust-msgpack.
great thanks, now I understand
from rust-msgpack.
Related Issues (20)
- Add enum support. HOT 3
- Out of touch with master. HOT 4
- Build failing on serialise::Decoder trait HOT 2
- Travis builds failing since bbd93a7 HOT 1
- Support rust enums HOT 1
- Doesn't compile with the latest rust HOT 1
- Fails to pack/unpack
- Structs are encoded w/ map type but are not valid msgpack maps! HOT 8
- Nullary option variants corrupt the next element in the decoder. HOT 2
- Publish to crates.io HOT 1
- Value is not Decodable after the move to associated types HOT 4
- port to rust 1.0.0 alpha
- Clone Trait
- Build is broken against nightly
- msgpack-rpc HOT 5
- Does not compile with rustc 1.7.0 HOT 3
- Won't Compile with rustc 1.15.0-nightly (8f02c429a 2016-12-15)
- It doesn't compile with byteorder v1.2.1 HOT 1
- Mark this library as deprecated
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rust-msgpack.