These are chat archives for rust-lang/rust

21st
Dec 2017
Moggers
@Moggers
Dec 21 2017 00:23
is there an error abstraction library like error-chain and quick-error that doesnt need std?
Steve Klabnik
@steveklabnik
Dec 21 2017 00:23
failure has a no-std mode
Moggers
@Moggers
Dec 21 2017 00:24
awesome thanks!
Roman
@rshirochenko
Dec 21 2017 11:37
Is it possible to do pattern matching on ref variable by type? Example,
let ref ref_c1: u8 = c;
match ref_c1 {
   u8 => println!("1"),
   _ => println!("2"),
}
(you can't match on just u8's type, you need enum or some condition for the match)
red75prime
@red75prime
Dec 21 2017 11:44
No. You can get limited runtime type info from Any though. fn foo<T: Any>(v: &T){ if v.is::<u8>() {println!("1");} }
Jonas Platte
@jplatte
Dec 21 2017 11:44
@rshirochenko What do you mean by "pattern matching by type"? Types are a compile-time construct, and matches happen at runtime.
Roman
@rshirochenko
Dec 21 2017 11:51
thanks!
David
@yenicelik
Dec 21 2017 16:52
Hey guys
so since the new version of rust cam out, the --no-capture option cannot be used anymore to show test outputs (right?); so how can I allow test-prints to be printed to the screen?
Aleksey Kladov
@matklad
Dec 21 2017 16:53
@yenicelik hm, this sounds like a bug to me!
David
@yenicelik
Dec 21 2017 16:53
wut
damn :D
Aleksey Kladov
@matklad
Dec 21 2017 16:53
Are you talking about nightly or stable rust?
David
@yenicelik
Dec 21 2017 16:53
nightl
y
Aleksey Kladov
@matklad
Dec 21 2017 16:53
I think it's worth filing an issue (or searching for the existing one). It definitely is supposed to work!
David
@yenicelik
Dec 21 2017 16:54
oh dammit
i'll do it then :)
Aleksey Kladov
@matklad
Dec 21 2017 16:54
Thanks!