|
gonadic io posted:Is there a way to generate an identifier inside a macro?
|
# ? Mar 22, 2017 18:14 |
|
|
# ? Jun 10, 2024 12:49 |
|
Ralith posted:Given that rust macros are intended to be hygenic, what happens if you just give the struct a fixed identifier directly? If it works at all I imagine it'll be scoped to the macroexpansion. That worked perfectly actually, thanks. Also because the struct is created inside the macro body expression anyway: code:
edit: is it best practice to have the expansion be code:
|
# ? Mar 22, 2017 18:25 |
|
Aren't Rust's macro's hygienic? Maybe I'm missing the point, sorry. E: new page, whoops
|
# ? Mar 22, 2017 19:43 |
|
gonadic io posted:I'm still not sure how this would affect how that block actually executes at run-time. Would all the type definitions and impls happen at compile-time so at run-time that's identical to just having the "Foo::new()" on its own? everything type related (as i understand it, in Rust) is static, i.e., at compile time. the compiler can prove that Foo implements Butt, but there's no way for you to refer to Foo anywhere outside of the macro rule (despite the fact that it's possible to interact with values of that type).
|
# ? Mar 22, 2017 21:09 |
|
gonadic io posted:I'm still not sure how this would affect how that block actually executes at run-time. Would all the type definitions and impls happen at compile-time so at run-time that's identical to just having the "Foo::new()" on its own?
|
# ? Mar 22, 2017 22:02 |
|
That's absolutely perfect then, entirely what I want. Now I just need to decide is this is a good idea or not:
|
# ? Mar 22, 2017 23:59 |
|
Or even better I could make a macro that's invoked like:code:
gonadic io fucked around with this message at 00:16 on Mar 23, 2017 |
# ? Mar 23, 2017 00:14 |
gonadic io posted:Or even better I could make a macro that's invoked like: Definitely do this, then post it here. This sounds awesome.
|
|
# ? Mar 23, 2017 00:54 |
|
gonadic io posted:Or even better I could make a macro that's invoked like: Awhile back I made a thing to allow binary literals to be entered as XX_XXX_XX to allow 'drawing' sprites for a Chip8 emulator. You need to use a compiler plugin rather than a macro to do that kind of stuff. Here is the response to my post: https://forums.somethingawful.com/showthread.php?threadid=3694683&pagenumber=6&perpage=40#post461902966
|
# ? Mar 23, 2017 01:07 |
|
gonadic io posted:Got my Arduino's ADC working in Rust! i'm p happy not going to lie Now to give it a decent and safe interface as opposed to casting a u32 constant to a memory address to a pointer to a struct . gonadic io fucked around with this message at 14:07 on Apr 4, 2017 |
# ? Apr 4, 2017 13:58 |
|
Has anyone used the Rust IntelliJ plugin with rustup? If so, how do you get it to find the standard library sources? It comes up with an option to download them, and I click on it and it doesn't error out or anything, and I can check that the rust-src component is installed and the rust sources are downloaded, but no matter what I do the plugin doesn't seem able to find them. Even if I manually point it at any of the folders in the source path, it says those are invalid.
|
# ? Apr 16, 2017 19:38 |
|
Asymmetrikon posted:Has anyone used the Rust IntelliJ plugin with rustup? If so, how do you get it to find the standard library sources? It comes up with an option to download them, and I click on it and it doesn't error out or anything, and I can check that the rust-src component is installed and the rust sources are downloaded, but no matter what I do the plugin doesn't seem able to find them. Even if I manually point it at any of the folders in the source path, it says those are invalid. I didn't do anything special. Try building your project.
|
# ? Apr 23, 2017 11:13 |
|
Asymmetrikon posted:Has anyone used the Rust IntelliJ plugin with rustup? If so, how do you get it to find the standard library sources? It comes up with an option to download them, and I click on it and it doesn't error out or anything, and I can check that the rust-src component is installed and the rust sources are downloaded, but no matter what I do the plugin doesn't seem able to find them. Even if I manually point it at any of the folders in the source path, it says those are invalid. Is this if you do the "New Project" dialog in IDEA? If so, I had the same issue but found I could leave it blank and it sorted itself out automatically upon doing the initial indexing. Here's a problem I've having at the moment with the plugin: How do I get IDEA to run the Visual Studio 2017 command prompt environment (vcvars64) to allow cargo to work properly (requires link.exe)? EDIT: Apparently it's a known issue with VS2017 and rustup/cargo. https://github.com/rust-lang/rust/issues/38584 https://github.com/rust-lang-nursery/rustup.rs/issues/1003 ssergE fucked around with this message at 02:45 on Apr 25, 2017 |
# ? Apr 25, 2017 02:38 |
|
ssergE posted:Is this if you do the "New Project" dialog in IDEA? If so, I had the same issue but found I could leave it blank and it sorted itself out automatically upon doing the initial indexing. I ran "Developer Command Prompt for VS 2017", dumped the variables with "set > env_file", then added the variables to my running configuration (.idea/workspace.xml). This way I was able to build and run directly from Intellij.
|
# ? Apr 25, 2017 15:51 |
|
If anybody was interested in my arduino rust project, there's a new amazing guide on the best toola/libraries to use for it: http://blog.japaric.io/quickstart/ I'm busy rewriting all of my manual cludges to use this stuff.
|
# ? May 1, 2017 21:29 |
|
So what's been going on in Rust-land in the last bit? Any major changes or features? I've been stuck in Python-land for research aside from some graphics projects with gfx and I'm wanting to get back into some Rust stuff.
|
# ? Jun 29, 2017 00:34 |
|
Linear Zoetrope posted:So what's been going on in Rust-land in the last bit? Any major changes or features? I've been stuck in Python-land for research aside from some graphics projects with gfx and I'm wanting to get back into some Rust stuff. How long have you been out? Here's the full list of changes by version, but picking some highlights from the last several versions:
|
# ? Jun 29, 2017 01:11 |
|
QuietMisdreavus posted:How long have you been out? Here's the full list of changes by version, but picking some highlights from the last several versions: I think impl trait is my favourite of the new features, just because it makes working with unboxed closures and iterators so much easier.
|
# ? Jun 29, 2017 07:50 |
|
gonadic io posted:I think impl trait is my favourite of the new features, just because it makes working with unboxed closures and iterators so much easier.
|
# ? Jun 29, 2017 18:17 |
|
Ralith posted:I don't think that's stable yet. Is it close? Not at all. There's still implementation bugs and lots of open design questions. However my Rust is entirely playing around with hobby projects, so I am fine with always using nightly.
|
# ? Jun 29, 2017 20:38 |
|
What is Rust is it some sort of Scientology? I dip into this thread every so often and I never seem to know half the terms you people fling about, and probably the other half don't mean what I think īt do. Is there some sort of indoctrination course you have to take?
|
# ? Jun 29, 2017 21:01 |
|
Yes, it is Scientology, but you aren't invited.
|
# ? Jun 29, 2017 21:03 |
|
I keep meaning to poke at rust but I don't have a good idea of what kinds of projects its well suited to. I've mostly only done webapps and web design like things, (ok and some automation scripts), are there any cool ideas for projects to build? I followed the tutorial in the docs a while back and built the guess checker, but that didn't really give me a good idea of what kinds of cool projects rust enables. Are there any really recommended tutorials or even just suggestions for things to build that people could recommend?
|
# ? Jun 29, 2017 21:50 |
|
TheCog posted:I keep meaning to poke at rust but I don't have a good idea of what kinds of projects its well suited to. I've mostly only done webapps and web design like things, (ok and some automation scripts), are there any cool ideas for projects to build? I followed the tutorial in the docs a while back and built the guess checker, but that didn't really give me a good idea of what kinds of cool projects rust enables. Are there any really recommended tutorials or even just suggestions for things to build that people could recommend? I built a packet parser (sort of tcpdump-ultralite with some extra mashing for couple particular types of packets) and I thought it worked fantastically well for that. It would also be good for the Matasano crypto challenges.
|
# ? Jun 29, 2017 22:34 |
|
TheCog posted:I keep meaning to poke at rust but I don't have a good idea of what kinds of projects its well suited to. I've mostly only done webapps and web design like things, (ok and some automation scripts), are there any cool ideas for projects to build? I followed the tutorial in the docs a while back and built the guess checker, but that didn't really give me a good idea of what kinds of cool projects rust enables. Are there any really recommended tutorials or even just suggestions for things to build that people could recommend?
|
# ? Jun 29, 2017 22:41 |
|
TheCog posted:I keep meaning to poke at rust but I don't have a good idea of what kinds of projects its well suited to. I've mostly only done webapps and web design like things, (ok and some automation scripts), are there any cool ideas for projects to build? I followed the tutorial in the docs a while back and built the guess checker, but that didn't really give me a good idea of what kinds of cool projects rust enables. Are there any really recommended tutorials or even just suggestions for things to build that people could recommend? Rust is built to fill the same niche as C/C++, in a sense. It lets you concern yourself with memory allocation, cache invalidation, and other kinds of hardware-informed optimizations. On the other hand, it's also designed in such a way that you don't have to deal with those concerns if you don't want to. Heck, my first big project was a twitter library, and that fucker is terrible with memory, compared to what I'd consider "optimal". I think if you're looking to make some kind of web API, or other kind of web facing thing, there's been a lot of work in that area that will make things really easy. (Rocket is really slick, if you haven't seen that one yet.) Other areas are more lacking, like GUI design, or database integration. There are means to do both of those things, but I don't think they've been polished to the point where they're easy to do in Rust.
|
# ? Jun 30, 2017 00:30 |
|
I made a web app with Rocket and tbh it almost put me off Rust entirely. Probably 90% of it happens in macros, and Rust has one of the worst macro systems ever. Rust is going to need to address this at some point because the rigidity of the language makes you use macros and macros are worthless without homoiconicity
|
# ? Jun 30, 2017 01:23 |
|
QuietMisdreavus posted:It lets you concern yourself with ... cache invalidation How's it do that?
|
# ? Jun 30, 2017 01:38 |
|
Thanks for all the suggestions and advice. I think I'm going to kick off with the easier cryptochallenges, and then maybe try my hand at a raytracer. I've never built anything like that before so it should be a fun challenge. I'll also poke at Rocket, although I honestly have enough ways to code web stuff, i'm always interested in seeing new implementations.
|
# ? Jun 30, 2017 04:03 |
|
JawnV6 posted:How's it do that? "Providing separate Vec and LinkedList types" was the main thing i had in mind. Maybe the other major thing i was thinking of was "a distinction between stack and heap", since that's easier to see.
|
# ? Jun 30, 2017 14:09 |
|
taqueso posted:Yes, it is Scientology, but you aren't invited. That doesn't sound much like Scientology at all! But joking aside, is there such a thing nowadays similar to that go tutorial? That was super efficient in getting me into go, to understanding the key points that set it apart from other languages I knew from previous and how to think about it. Rust didn't have that in the past (afaik?) so I'm still an ignoramus. Does it now?
|
# ? Jun 30, 2017 15:03 |
|
Karate Bastard posted:That doesn't sound much like Scientology at all! The book is nice (check out the second edition first): https://doc.rust-lang.org/book/ There is also Rust by Example which is useful: https://rustbyexample.com/ Additionally you might find this guide useful later after you get the basics: https://github.com/kmcallister/rustic-symmetries e: The docs are quite useful and contain a lot of examples: https://doc.rust-lang.org/std/ PS: You can view the actual code from the documentation pages by clicking [src] at the top. e2: Don't forget to check out the super friendly user forum: https://users.rust-lang.org/ and IRC: #rust-beginners @ irc.mozilla.org Workaday Wizard fucked around with this message at 15:25 on Jun 30, 2017 |
# ? Jun 30, 2017 15:16 |
|
Hey neat, thanks!
|
# ? Jun 30, 2017 15:27 |
|
To add onto the resource pile, Rustlings is a really great set of small exercises that echoes the (first edition) book in terms of what it introduces when. Plus it leans on the playground, which is a truly fantastic resource to get your feet wet with Rust without having to install anything.
|
# ? Jun 30, 2017 21:14 |
|
xtal posted:I made a web app with Rocket and tbh it almost put me off Rust entirely. Probably 90% of it happens in macros, and Rust has one of the worst macro systems ever. Rust is going to need to address this at some point because the rigidity of the language makes you use macros and macros are worthless without homoiconicity
|
# ? Jul 1, 2017 04:13 |
|
Ralith posted:I don't have any experience with Rocket, but I hardly ever find myself reaching for macros when writing Rust. First-class functions, closures, traits, and polymorphism go a long way. Which is good, because macros 1.0 really do suck for any but the most trivial uses. Custom derive (stable, demonstrated nicely by serde) and the upcoming macros 2.0 (which gives you full-powered source-to-source transforms) are a lot nicer, fortunately. The only things that I define my own macros for are 1) early returns, like: code:
code:
gonadic io fucked around with this message at 23:38 on Jul 2, 2017 |
# ? Jul 2, 2017 23:35 |
|
I want to be able to build EDSLs. My day job is C++ so I'm not exactly chafing at Rust's lack of expressiveness, but it'll be a good day when the next iteration is stabilized.
|
# ? Jul 2, 2017 23:59 |
|
I really like rust and I can't wait for it to become employable so I can get a job writing it.
|
# ? Jul 17, 2017 23:04 |
|
Just get a job writing C and use extern no_mangle
|
# ? Jul 17, 2017 23:06 |
|
|
# ? Jun 10, 2024 12:49 |
|
Technically there's https://rustjobs.rs/, but it's fairly light (apparently they went and scrubbed all the ones that have been filled since the last time i looked).
|
# ? Jul 18, 2017 00:33 |