These are chat archives for rust-lang/rust

4th
Dec 2017
Fra ns
@snarf95_twitter
Dec 04 2017 09:55 UTC
Yup been like that for 2-3 days now
It’s due to missing rls-preview
Andrey Lesnikov
@ozkriff
Dec 04 2017 10:07 UTC
@steveklabnik hi, is it ok that osx beta is still broken for zemeroth?
Zakarum
@omni-viral
Dec 04 2017 12:23 UTC

I have a problem when using Derivative on structure with reference field. When this field need custom format function.

The code looks like this

#[derive(Derivative)]
#[derivative(Debug)]
struct Foo<'a> {
    ... // more fields
    #[derivative(Debug(format_with="fmt_events_loop"))]
    events: &'a EventsLoop,
}

fn fmt_events_loop(events: &EventsLoop, fmt: &mut fmt::Formatter) -> fmt::Result {
    write!(fmt, "EventsLoop")
}

And the error:

in type `&'_derivative &'a winit::EventsLoop`, reference has a longer lifetime than the data it references
Denis Lisov
@tanriol
Dec 04 2017 12:33 UTC
I'd guess this can be a bug in derivative...
Steve Klabnik
@steveklabnik
Dec 04 2017 13:11 UTC
@ozkriff not sure, i didn't know beta was broken
So it seems that rust just actually can't handle composed trait objects :(
And it gives you really weird errors too
Could anyone help?
The impl's are all 'legal' to write, but apparently illegal to use. I've tried specifying coerced as &TraitA but that just makes it mad (unsized type)
Denis Lisov
@tanriol
Dec 04 2017 14:18 UTC
@Restioson What are you actually trying to do?
Restioson
@Restioson
Dec 04 2017 14:18 UTC
Unfortunately, that :(
with real traits
have a CoerceToWhatever trait which returns Whatever if the type it is called on is an instance of Whatever
to let terminals remain generic but also allow access to subtrait features like colors if supported
Maybe there's a better way I haven't thought of, but ideally i dont want to just include all the methods and then just error if they arent supported...
Yavuz Günay
@yvz5
Dec 04 2017 14:33 UTC
is there any video editing library ?
Sherab Giovannini
@Shaddy
Dec 04 2017 15:19 UTC
@yvz5 since anyone anwser you I would say that no
https://github.com/rust-unofficial/awesome-rust <= here you have a pretty good crate classify
and there is nothing related to video/audio but bindings instead, which is an option tbh
you should have bindings to mostly all typical popular libs out there
there are bindings for gstreamer and such libs like that
Denis Lisov
@tanriol
Dec 04 2017 15:50 UTC
@Restioson Looks like you're trying to invent something like Any?
Karan Chaudhary
@lafolle
Dec 04 2017 18:45 UTC
Hi, I need to send a HTTP req where content-type provided by user. How can i check if content type is valid of not, and if valid set correct header on request using hyper?
Sherab Giovannini
@Shaddy
Dec 04 2017 22:31 UTC
https://docs.rs/reqwest/0.1.0/reqwest/header/trait.Header.html#tymethod.parse_header this is from reqwest, but the approach should be similar