Coder Social home page Coder Social logo

Comments (5)

viperscape avatar viperscape commented on July 21, 2024

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.

thehydroimpulse avatar thehydroimpulse commented on July 21, 2024

@viperscape Make sure you update the library version. If you're using cargo, you can run cargo update.

from rust-msgpack.

viperscape avatar viperscape commented on July 21, 2024

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.

thehydroimpulse avatar thehydroimpulse commented on July 21, 2024

@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.

viperscape avatar viperscape commented on July 21, 2024

great thanks, now I understand

from rust-msgpack.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.