These are chat archives for rust-lang/rust

8th
Nov 2016
Matanel Levi
@matanelevi
Nov 08 2016 10:00
Hello, a question regarding to macros:
What fragment specifier should I use if I want to pass a function inside a module?
Kang Seonghoon
@lifthrasiir
Nov 08 2016 10:00
function definition, function call or function name?
Matanel Levi
@matanelevi
Nov 08 2016 10:01
Like this: my_macro!(module::funcname)
Kang Seonghoon
@lifthrasiir
Nov 08 2016 10:01
that’s a generic path (a generalization of name) and $p:path should be used
Matanel Levi
@matanelevi
Nov 08 2016 10:03
Oh...
Thanks dude! Works like a magic :)
Kang Seonghoon
@lifthrasiir
Nov 08 2016 10:03
:)
Matanel Levi
@matanelevi
Nov 08 2016 11:57
Hey, if I want to use io crate with #![no_std], can I implement it? specifically I want to implement io::stdin()
What I'm trying to ask is that if there is an underlying function such as __rust_allocate, but in this case to io::stdin
Matanel Levi
@matanelevi
Nov 08 2016 12:03
I guess there isn't :)
Matanel Levi
@matanelevi
Nov 08 2016 13:02
What's the difference between an impl function (of enum) that gets &self, to other function that gets no arguments at all? I mean, what can I do with self?
Can I somehow access with self the specific enum value that called the function?
Sergey Noskov
@Albibek
Nov 08 2016 13:04
just use self as usual variable match *self { Enum::Variant1(i) => ...}
Matanel Levi
@matanelevi
Nov 08 2016 13:18
alright.. thanks :)