These are chat archives for rust-lang/rust

16th
Apr 2018
Denis Lisov
@tanriol
Apr 16 2018 07:55
@kellytk Looks to me like RX-like operations are a bit higher level than Stream ones and likely to take either ergonomic hit or non-zero performance overhead in Rust... however, they certainly should be possible to build on top of Streams. Some parts of this are probably not yet available in futures, only in separate crates.
Nathan Wilson
@iancormac84
Apr 16 2018 07:58
Hello. How can I get the following code to compile?
How do I make the compiler understand that I want the object represented by 'self' to be destroyed, and therefore it doesn't matter that it doesn't live as long as the new object that is being created with the reference to the str?
Nathan Wilson
@iancormac84
Apr 16 2018 08:03
Made some changes to the example
Denis Lisov
@tanriol
Apr 16 2018 08:06
@iancormac84 Note that the link does not get updated automatically when you update your example
Nathan Wilson
@iancormac84
Apr 16 2018 08:07
@tanriol I just realized that. One sec.
yeah sorry about that. I basically want the instance of B to pass on its reference to the Foo::Baz(C<'a>) instance and then die.
Is that possible?
Nathan Wilson
@iancormac84
Apr 16 2018 08:12
I know I can avoid the lifetime problems by using Strings and cloning, but I'm curious about avoiding allocation. The &'a str is itself a reference to a &'static str, so the data is guaranteed to be available for the lifetime of the program.
Karthik Ravikanti
@plumenator
Apr 16 2018 08:53
Is there ever a reason to use unbounded over forward to read from a Stream and then write to a Sink?
Oops wrong channel, please ignore :D
Denis Lisov
@tanriol
Apr 16 2018 09:15
@iancormac84 The problem here is that the trait A says that you can convert self into a Foo with any lifetime requested, including 'static, which is not the case. If you know everything is 'static, I'd suggest using it as such.
Nathan Wilson
@iancormac84
Apr 16 2018 09:42
@tanriol thanks. I got a solution to the problem that involved changing where I placed the lifetime annotations: https://play.rust-lang.org/?gist=18d1a15aa085dd2b4a1a67a7c3f5f847&version=stable