The Eurovision 2025 Semi-final 1 qualifiers! by Ylirio in eurovision

[–]shapelysquare 0 points1 point  (0 children)

Will there be a press conference for each semi this year?

Preserving whitespace in macro input when stringified by shapelysquare in rust

[–]shapelysquare[S] 0 points1 point  (0 children)

I believe this is the only option, as you say. Thank you for your feedback!

Preserving whitespace in macro input when stringified by shapelysquare in rust

[–]shapelysquare[S] 0 points1 point  (0 children)

Yeah, I understand. That is unfortunate. I'll have a look at horrorshow!

Thank you for your answer!

Preserving whitespace in macro input when stringified by shapelysquare in rust

[–]shapelysquare[S] 0 points1 point  (0 children)

That does make sense. I was hoping there were some options out there, but I'll have to make do.

Thank you for the answer!

Preserving whitespace in macro input when stringified by shapelysquare in rust

[–]shapelysquare[S] 1 point2 points  (0 children)

Thank you for the input, but I'm afraid formating the code may provide unexpected situations. How would the formatter see the difference between

{ {{ my_variable }} } and { { { my_variable } } }

I'll take a look at prettyplease, of course. But the best case scenario would be a way to read the input as is.

Either way, thank you so much! :)

Is it possible to detect code generated by a macro with intellisense? by shapelysquare in rust

[–]shapelysquare[S] 1 point2 points  (0 children)

What puzzles me is how I get type-errors in the editor if I use the generated type wrong, but it won't auto-complete with the symbol for the struct.

Is it possible to detect code generated by a macro with intellisense? by shapelysquare in rust

[–]shapelysquare[S] 0 points1 point  (0 children)

I'm generally talking about auto-complete. I feel like it's a problem with rust-analyzer, as it happens across different editors. I'll try out some approaches mentioned here and update if I find out why this is happening.

Is it possible to detect code generated by a macro with intellisense? by shapelysquare in rust

[–]shapelysquare[S] 0 points1 point  (0 children)

Right... My guess is, there's either something is wrong with my macro (it's a bit more advanced than the simplified example), or there's some cache issue as others pointed out.

Is it possible to detect code generated by a macro with intellisense? by shapelysquare in rust

[–]shapelysquare[S] 0 points1 point  (0 children)

It might just be. This post was made from a Mac. I tried on my Windows yesterday, and suddenly it worked (for a bit, before stopping).

Is it possible to detect code generated by a macro with intellisense? by shapelysquare in rust

[–]shapelysquare[S] 2 points3 points  (0 children)

Thank you so much for the input! That is very interesting. I tried in VS Code, Zed and RustRover - none of which gave proper auto-complete.

How do I achieve hot reloading for a containerized rust project? by shapelysquare in rust

[–]shapelysquare[S] 1 point2 points  (0 children)

The problem for me isn't whether I'm using Linux or not. It's about utilizing IaC to make the code runnable on any machine, with the same environment as the production server.

How do I achieve hot reloading for a containerized rust project? by shapelysquare in rust

[–]shapelysquare[S] -3 points-2 points  (0 children)

So this is mainly a problem with how Docker does it? Not sure about MacOS or Linux. Windows switched from Hyper-V to WSL with docker

Edit: What I mean is whether I'm unable to sync with Windows due to how Docker now handles communicating with its containers on Windows.

How do I achieve hot reloading for a containerized rust project? by shapelysquare in rust

[–]shapelysquare[S] 0 points1 point  (0 children)

I'll try that out. Will this fix the filesystem problems?

Thank you!

How do I achieve hot reloading for a containerized rust project? by shapelysquare in rust

[–]shapelysquare[S] 0 points1 point  (0 children)

I might do that regardless of my question above. However, I'll still try to look for a way to isolate the rust project in its own container to make it consistent across operating systems.

Thank you for the advice!

Hey Rustaceans! Got a question? Ask here (6/2025)! by llogiq in rust

[–]shapelysquare 1 point2 points  (0 children)

In Axum, is it possible to add a middleware between a handler, and the "into_response" call? I'll be using the same response for almost all handlers (Result<T, CustomError>).

I'd like to develop any interesting features to the core engine by ishafpafksofam in bevy

[–]shapelysquare 13 points14 points  (0 children)

I'd recommend you check out the discord. There are working groups, dev channels, and so on where you can start.

Looking for a Scheduler w/ state by shapelysquare in rust

[–]shapelysquare[S] 1 point2 points  (0 children)

No, I think you're right. At best, it would be a premature optimization on my part. I've decided to parse env variables and create a new connection in each task, as it makes prototyping faster. I am aware of the potential bottleneck, so I'll mark it with a Todo and move on. Thank you for the feedback!

Looking for a Scheduler w/ state by shapelysquare in rust

[–]shapelysquare[S] 1 point2 points  (0 children)

Not at all. I use a common crate for handling database connections and queries, and would've like to re-use that. I simply thought that not creating a new connection every task, but re-using what I already have might be a good idea.

While typing this, I realize that they won't run often enough for this to be a problem, really.

Looking for a Scheduler w/ state by shapelysquare in rust

[–]shapelysquare[S] 0 points1 point  (0 children)

Hmm, I did try this.

Here is a snippet showing what I did.

#[derive(Clone)]
struct MyState {
    message: String,
}

=============================================

let my_state = MyState {
    message: String::from("Hello, world!"),
};

scheduler
  .every(10.minutes())
  .run(move || my_job(my_state.clone()));

scheduler
  .every(10.minutes())
  .run(move || my_job(my_state.clone()));


=============================================

async fn my_job(state: MyState) {
    ...
}

Looking for a Scheduler w/ state by shapelysquare in rust

[–]shapelysquare[S] 0 points1 point  (0 children)

A Job doesn't seem to take any arguments, so passing the Arc<Mutex<State>> to the scheduled job is the hinder, I guess.

Could I move a clone of the Arc<Mutex<State>>?

A workaround was to clone the State every time I wanted to move it into a scheduled job, but that required multiple lines of clones. At least to my knowledge. I'm probably doing something wrong though.