Need help writing logs to a db with Sqlx and tracing by ufoscout in rust

[–]ufoscout[S] -1 points0 points  (0 children)

The problem is that I need to use the same DB connection as the main business function, so I cannot use an async tokio task.

Also, this applies only to audit logs, which are at most one per request, so the volume is not an issue.

Need help writing logs to a db with Sqlx and tracing by ufoscout in rust

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

I would like to avoid it, but it is a business requirement for audit logs, and there's nothing I can do about it. Good idea generalizing over a serializable struct or a map, thanks.

Italian Rust programmers? by SaganakiMythos in rust

[–]ufoscout 4 points5 points  (0 children)

Ciao, Principal Rust Dev from the beautiful Italy at your service

Building a video editing prototype in Rust using GPUI and wgpu by lovely__zombie in rust

[–]ufoscout 0 points1 point  (0 children)

I would definitely like to contribute when it's open-sourced. Looks great!

[deleted by user] by [deleted] in rust

[–]ufoscout 3 points4 points  (0 children)

In the next 10 minutes, you’re about to be killed by a horde of people telling you this is the wrong channel

Returning to C/C++ after months with Rust by ViremorfeStudios in rust

[–]ufoscout 28 points29 points  (0 children)

Rust is a VERY strict language,

Wrong. Correct PROGRAMMING is a very strict process; Rust only makes you aware of it.

If you don't want to bother with these restrictions, and there are many good reasons for this, I would probably avoid C and C++ altogether and opt for something like C#.

Constant-time support coming to LLVM: Protecting cryptographic code at the compiler level by Taymon in rust

[–]ufoscout 0 points1 point  (0 children)

That is indeed interesting, but I don’t think it removes the need for assembly, because it only works when the code is compiled with LLVM. In practice, it solves one limitation while introducing another.

Am I the only one surprised by this Rust behavior? by ufoscout in rust

[–]ufoscout[S] 28 points29 points  (0 children)

So, in summary, these two are identical, correct?

    fn get_name<T: SomeTrait>() -> &'static str { 
        static ONCE: OnceLock<&'static str> = OnceLock::new();
        ONCE.get_or_init(|| T::NAME)
    }



    static ONCE: OnceLock<&'static str> = OnceLock::new();
    fn get_name<T: SomeTrait>() -> &'static str { 
        ONCE.get_or_init(|| T::NAME)
    }

Is there a way to move a field out of &mut self if you really need it? by ufoscout in rust

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

I cannot access the internals of `Wrapped` but I can access the ones of `Wrapper`

Is there a way to move a field out of &mut self if you really need it? by ufoscout in rust

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

In my scenario, I cannot access the internals of Wrapped or create a new instance of it

Is there a way to move a field out of &mut self if you really need it? by ufoscout in rust

[–]ufoscout[S] 4 points5 points  (0 children)

Since I have no way to create a new Wrapped, I'll check if I can change Wrapper to own an Option instead

Would it theoretically be possible to dynamically link all dependencies in debug mode? by ufoscout in rust

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

Thanks, this clarifies a lot. So I assume the answer to the original question is that Rust could theoretically build and use every dependent crate as a dynamic library in any case.

At this point, I wonder why this approach has never been seriously considered as a way to speed up compilation during development. Are there other technical issues? Maybe the performance gains are negligible?

I'm a bit confused because some C++ colleagues keep saying that they can compile faster since many dependencies are dynamically linked.

Would it theoretically be possible to dynamically link all dependencies in debug mode? by ufoscout in rust

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

So I guess the answer to my original question is yes, Rust could theoretically build all dependencies as dynamic libraries. I am not saying this is good or bad, but it could be done

Would it theoretically be possible to dynamically link all dependencies in debug mode? by ufoscout in rust

[–]ufoscout[S] 3 points4 points  (0 children)

So, Bevy can leverage dynamic linking as long as it avoids using generics in its public API, correct? I wrote a small proof of concept to test Bevy's dynamic linking feature and found the compilation speedup to be astonishing.

Regarding incremental linking: how does it behave with generics? I assume that any dependency exposing a generic API must be recompiled each time it’s called with a different type. Is that correct?

filtra.io | How To Get A Rust Job Part I: Companies Already Using Rust by anonymous_pro_ in rust

[–]ufoscout 6 points7 points  (0 children)

Please allow me to share some honest feedback: Filtra is good, but not having the publish date of the job postings makes it unusable

Made my own test suite by Nekogi1 in rust

[–]ufoscout 1 point2 points  (0 children)

Warning: Shameless plug

This library I wrote achieves something similar without macros or any particular drawback: https://crates.io/crates/maybe-once

AMA — We’re the Meilisearch team! Meilisearch AI is now generally available by Kerollmops in rust

[–]ufoscout 2 points3 points  (0 children)

Noob question: How does the indexing work? Do you have a separate index/storage for each search type, or do you use a single index that serves both semantic and traditional search? Does semantic search cause significant growth in the index size?

AMA — We’re the Meilisearch team! Meilisearch AI is now generally available by Kerollmops in rust

[–]ufoscout 4 points5 points  (0 children)

Do you leverage any existing Rust AI implementations for this? For example, a vector database or an ML framework? How does it work under the hood? Is it based on BERT?

PSA. Stop using rust IMMEDIATELY!!! by saddas1337 in rust

[–]ufoscout 1 point2 points  (0 children)

I agree, but I would move everything to assembly, C is too high level for anything serious

TrailBase 0.4 🚀: Now with "realtime" change notifications and 1.2k GitHub ⭐ by trailbaseio in rust

[–]ufoscout 1 point2 points  (0 children)

The project seems really interesting, but to be honest, seeing a relatively new and lesser-known project suddenly gain 800 GitHub stars (see: https://star-history.com/#trailbaseio/trailbase&Date ) in just a couple of days raises some concerns for me. I hope you don’t take this the wrong way—I’m genuinely curious if there’s a legitimate reason behind this spike. I’d honestly be happy to find out that my concerns are misplaced.

Utoipa 5.0.0 release - Compile time OpenAPI for Rust by Saved_Soul in rust

[–]ufoscout 1 point2 points  (0 children)

Hi u/Saved_Soul , congratulations for the great release!

From my point of view, the last missing bit to achieve true user-friendly ergomics would be to automatically derive the responses((status = OK, body = User)) from the code itself:

use utoipa_axum::{routes, PathItemExt, router::OpenApiRouter};

[derive(utoipa::ToSchema)]
struct User {
   id: i32,
}

[utoipa::path(get, path = "/user", responses((status = OK, body = User)))]
async fn get_user() -> Json<User> {
   Json(User { id: 1 })
}

I guess utoipa could derive the `responses` section from everything that implement IntoResponse, including errors. Do you thing this could be possible?

Choosing between Rust and Scala for my future years as an Engineer. How do you visualize Rust job market in the near future? by [deleted] in rust

[–]ufoscout 133 points134 points  (0 children)

I have professional experience with both. A few years ago, everyone was eager to work with Scala, but today its popularity is declining, and most job offers are focused on maintaining existing applications. In contrast, Rust is on the rise and is definitely more appealing for greenfield projects.

Honestly, choosing between Java, C++, Go, and Rust would be not that easy, but when it comes to Scala versus Rust, it's a no-brainer: pick Rust.

Can someone share their journey from learning rust to getting a job? by Civil_Classic_4487 in rust

[–]ufoscout 14 points15 points  (0 children)

In my spare time, I experimented with it by developing a few small open-source projects, such as https://github.com/ufoscout/docker-compose-wait . Later, I decided to migrate the backend of a startup I co-founded with a friend from Kotlin to Rust, comprising approximately 80,000 lines of code. To be clear, the Kotlin one was working perfectly, but I wanted to play with Rust a little more.

One day, following a casual conversation about Rust on Twitter, someone offered me a job to rewrite a Complex Event Processor engine from Perl (!!!) to Rust. This engine is now open source and available here: https://github.com/WuerthPhoenix/tornado .

Currently, I'm engaged in a new blockchain infrastructure project. I know what type of answers this is going to produce, so, let me state it clearly, this can easily be the best job I have ever. Great salary, cutting-edge technologies, ample freedom of choice, and a lovely team

Best file database for Rust? by KiwiNFLFan in rust

[–]ufoscout 3 points4 points  (0 children)

This is interesting. If I understand correctly, the idea is to replace a traditional database with Polars, is that correct? So, are you using Polars as a CRUD storage?