These are chat archives for rust-lang/rust

15th
Mar 2018
Sylwester Rąpała
@xoac
Mar 15 2018 00:02
I know there is bytes::BytesMut that can store bytes in noncontinous memory. Mayby there is a implementation for string, or you can start looking there how to implement it.
ousado
@ousado
Mar 15 2018 06:10
@Kane-Sendgrid you might want to look around for rope implementations in rust
Denis Lisov
@tanriol
Mar 15 2018 06:39
@Kane-Sendgrid It will double capacity, AFAIK.
estk
@estk
Mar 15 2018 17:38
Hi there, i'm new to rust and trying to use tokio/hyper to make some http requests. I just posted my question in stack overflow, if anyone could help that would be great! https://stackoverflow.com/questions/49305863/rust-tokio-hyper-with-new-tokioreactor-type-mismatch
Sylwester Rąpała
@xoac
Mar 15 2018 18:12
@estk add some code to that question.
And there is response in compiler error | ^^^^^^ expected struct `tokio_core::reactor::Handle`, found struct `tokio::reactor::Handle
expected tokio_core.. found tokio..
Philippe SEGATORI
@tigitz
Mar 15 2018 19:14
Does anyone can recommend a rust library that can parse a .rs file, generate an AST that can be manipulated and let me transformed it back to a .rs file? I found syn and pest but it doesn't seem to fit my requirements or examples are not clear enough on the subject. Thanks
Jimmie Fulton
@jimmiebfulton
Mar 15 2018 22:20
Hi folks. New to systems level programming and rust. I’m interested in zero-copy serialization/deserialization. I’m not certain, but I think I may have identified a bug regarding serde deserialization of borrowed byte arrays. I’ve got deserialization of &str working fine, but deserializing a byte array slice doesn’t work. https://play.rust-lang.org/?gist=d6dbb7a0740da418f95e8e59e526b0fa&version=stable
BTW, I’ve also tried serializing with rmp_serde (MessgagePack), and I get the same error.
Danny Angelo Carminati Grein
@fungos
Mar 15 2018 23:08

Hello, I'm having some trouble with failure::Error that I can't figure out:

#[derive(Fail, Debug)]
#[fail(display = "missing required field: {}", _0)]
pub struct MissingField(&'static str);

then trying to open a file:

fn test() -> Result<(), Error> {
    Err(MissingField("x"))
}

    = note: expected type `MissingField`
               found type `failure::Error`

If I remove "Error" from the returning result it works, but in my current case I'm using an external dependency that has this kind of return and I'm returning my errors in a future for that API. So the error represented here is the same I get there.
Any hints on what I'm missing here?