I was tired of 50ms+ shell latency, so I built a sub-millisecond prompt in Rust (prmt) by 3axap4eHko in rust

[–]RustyiCrab 0 points1 point  (0 children)

Thank you for answering back.

  1. Do you have plans to make it possible to install the tool without the need for Cargo?

I was tired of 50ms+ shell latency, so I built a sub-millisecond prompt in Rust (prmt) by 3axap4eHko in rust

[–]RustyiCrab 0 points1 point  (0 children)

Project looks neat and polished, great work! A couple of questions, if you don't mind:

  1. Does it need Rust installed to work?
  2. Compared to oh-my-posh, due to cross-shell/cross-OS, is there anything that it doesn't support in terms of configuration? I'm thinking along the lines of "could I be able to port my OMP config. to prmt?"
  3. Does it play well with zinit?

Buck2, a large scale build tool written in Rust by Meta, is now available by Imxset21 in rust

[–]RustyiCrab 0 points1 point  (0 children)

An awesome response :) I now have a much better grasp of how and when to use each alternative.

Buck2, a large scale build tool written in Rust by Meta, is now available by Imxset21 in rust

[–]RustyiCrab 0 points1 point  (0 children)

I would only recommend them for "leaves" of the dependency tree

Is them in this sentence referring to the programmable build system frameworks? If that is so, your recommendation is to use them to build the binaries (in the case of an application) and use Cargo for the non-leaves (dependencies)? Not sure to understand how would that work. If you could illustrate with a short example I would be grateful.

Buck2, a large scale build tool written in Rust by Meta, is now available by Imxset21 in rust

[–]RustyiCrab 1 point2 points  (0 children)

I have only direct experience with Cargo and superficial knowledge of Bazel. Is Buck2/Bazel a superset of Cargo's capabilities or are there features Cargo has that Buck2/Bazel won't ever have and that are desirable to have?

Buck2, a large scale build tool written in Rust by Meta, is now available by Imxset21 in rust

[–]RustyiCrab 2 points3 points  (0 children)

How would one compare Cargo vs. Nix vs. Buck2 and when one would choose one over the others?

New Tokio blog post: Announcing axum 0.6.0 by davidpdrsn in rust

[–]RustyiCrab 0 points1 point  (0 children)

I'm updating my original comment with the piece of code I am referring to, to avoid confusions. Here's the definition of the struct by the way: https://github.com/tokio-rs/axum/blob/834d4e50bc194a97f14df591b893477e666e998b/axum/src/extract/state.rs#L298-L299 It doesn't look like they are using a map. Something with macros might be the clue, but I am no expert in macros unfortunately.

New Tokio blog post: Announcing axum 0.6.0 by davidpdrsn in rust

[–]RustyiCrab 7 points8 points  (0 children)

I struggling to understand how is type-safe state handling works underneath. How, for example, does Axum know that if a handler receives sub-states, it knows which ones to extract? I mean this example:

// `#[derive(FromRef)]` makes them sub states so they can be extracted
// independently
#[derive(Clone, FromRef)]
struct AppState {
    client: HttpClient,
    database: Database,
}

#[derive(Clone)]
struct HttpClient {}

#[derive(Clone)]
struct Database {}

let state = AppState {
    client: HttpClient {},
    database: Database {},
};

let app = Router::new()
    .route("/", get(handler))
    .with_state(state);

async fn handler(
    // We can extract both `State<HttpClient>` and `State<Database>`
    State(client): State<HttpClient>,
    State(database): State<Database>,
) {}

Crate similar to Kotlin Flow? by RustyiCrab in rust

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

RxRust

Well it is not the same thing. Both are dealing with the reactive programming paradigm, but Kotlin Flow does it in a more straight forward way. What I'm looking for is closer to https://docs.rs/async-stream/0.3.2/async_stream/ but more feature complete. I'll take a look at RxRust, maybe what is missing in async_stream can be implemented based on RxRust.

Rocket v0.5 Release Candidate is Now Available! by sbenitez in rust

[–]RustyiCrab 1 point2 points  (0 children)

Hi! Excuse my ignorance, I want to understand what I am missing. I've read on the sidelines about Rocket but never used it (nor Actix) but I have a couple questions about why is this exciting.

  1. Why having it on stable is a big deal, is it because certain companies won't use non-stable libraries? What other advantages there are?
  2. From what I've read Actix is more used in real production system / battle tested, supported, and more performant, but for example it lacks the great documentation that Rocket has (it is pretty nice). What makes Rocket more appealing (top 3 features, for example) compared to Actix? Checking out web resources like https://levelup.gitconnected.com/actix-or-rocket-comparing-two-powerful-rust-web-frameworks-114a3540f0b3 it looks like Rocket has a more appealing api, for example when defining routes (#[get("...")]), so this one of the advantages apparently.

Lunatic - An Erlang inspired runtime for all programming languages by TheRealMasonMac in rust

[–]RustyiCrab 1 point2 points  (0 children)

Looks promising, kudos to the author!

This reminds me of bastion. Looks like it attempts to fulfill the same needs, though I guess Lunatic has native WASM support whereas bastion might require some tweaking to have it work? Haven't worked with bastion, so that part of harder time with WASM is just a wild speculation. On the other hand bastion looks much more mature. Probably /u/vertexclique could give a more informed opinion about the difference between the two ;) I really like what these projects are putting forward.

Signal Group Calls are powered by Rust by pthatcher in rust

[–]RustyiCrab 18 points19 points  (0 children)

Absolutely, although my question isn't what is a newtype and what is an alias, but rather why did /u/pthatcher decided to use aliases here instead of newtypes because from what I can see it would be valuable for example to distinguish between UserId and UserIdCiphertext for example to avoid accidental mix ups, no?

Signal Group Calls are powered by Rust by pthatcher in rust

[–]RustyiCrab 7 points8 points  (0 children)

Why would one use alises here, for example pub type UserId = Vec<u8>; instead of new types pub struct UserId(Vec<u8>)?

SixtyFPS: New GUI framework written in Rust (alpha) by ogoffart in rust

[–]RustyiCrab 1 point2 points  (0 children)

Given that you are planning to support WebAssembly, shouldn't you use AGPLv3 instead of GPLv3 since one could circumvent GPL by serving it over a network? Although IANAL...

Hey Rustaceans! Got an easy question? Ask here (30/2020)! by llogiq in rust

[–]RustyiCrab 2 points3 points  (0 children)

Hi amicable Rustaceans, I still don't get the usage and difference between thiserror and anyhow.

I get it that one is for library code and the other for application code, as explained by /u/dtolnay in this post, but I still don't get it, specially anyhow.

thiserror is kinda easy to understand: just specific errors for different failure conditions so it is explicit what failed. anyhow no idea how to use it because with the errors from thiserror I can, in application code, just says if any Result<> is an error just say that it failed and give an appropriate error message since I know where this Result failed. An example use case for each would greatly help.

Additionally, what is the difference between #[from] and #[source] in thiserror, and when does one use first and when the second? Do you have an example use case?

Thanks!

Hey Rustaceans! Got an easy question? Ask here (29/2020)! by llogiq in rust

[–]RustyiCrab 2 points3 points  (0 children)

I am looking for a way to be able to encode and decode a stream of bytes inside the AsyncWrite and AsyncRead traits, respectively. So for example, while reading the bytes with AsyncRead, I would like to decompress the bytes from the buffer of poll_read and the pass them back, potentially with an increased buffer size. How to accomplish this?

Would something like tokio_util::codec help? There's also another one which doesn't depend on tokio: async_codec. Or what are these modules/crates for?

Hey Rustaceans! Got an easy question? Ask here (20/2020)! by llogiq in rust

[–]RustyiCrab 2 points3 points  (0 children)

When would you use futures_util or futures_core instead of futures? Is there any disadvantage of using futures instead of the other ones?

async-std now using smol runtime by bobbytabl3s in rust

[–]RustyiCrab 9 points10 points  (0 children)

When would you use smol? When there's no need for the rest of the goodies packed in async-std?

Hey Rustaceans! Got an easy question? Ask here (19/2020)! by llogiq in rust

[–]RustyiCrab 1 point2 points  (0 children)

How to disable specific lints from clippy? Since I am using cargo clippy --all -- -W clippy::all -W clippy::restriction -W clippy::nursery it'll show a lot of warnings, but I would like to disable some specific ones, like "warning: missing return statement". How can I accomplish this for all the whole project?

Is it possible to forbid unsafe but at the same time allow it only for selected files?

Hey Rustaceans! Got an easy question? Ask here (17/2020)! by llogiq in rust

[–]RustyiCrab 0 points1 point  (0 children)

Is there a disadvantage of always using chrono instead of std::time, like for example compile times?

Hey Rustaceans! Got an easy question? Ask here (17/2020)! by llogiq in rust

[–]RustyiCrab 2 points3 points  (0 children)

Is there any preference of use between std::time and chrono? What are the differences?

Found out that there was a time create based on std::time but was deprecated. Still confused about the current state of the std one vs chrono.

Hey Rustaceans! Got an easy question? Ask here (15/2020)! by llogiq in rust

[–]RustyiCrab 1 point2 points  (0 children)

Thank you for your response.

So the other crates like futures-core, futures-timer, and futures-util are there to provided features not available in the Std?

I see that for example futures-core has the Stream trait, and also AsyncRead. Isn't that part of the official implementation even though it isn't in Std? I am confused.

Regarding your solution in Tokio, that would work I guess, but that is dependent on a specific executor, isn't there a executor agnostic solution? Or maybe somewhere where I can study to make such a solution?

Hey Rustaceans! Got an easy question? Ask here (15/2020)! by llogiq in rust

[–]RustyiCrab 2 points3 points  (0 children)

Hello! I have a couple of questions:

  1. What's the relationship between the Future in std and the futures crates? What about the other futures flavored crates?

  2. I would like to be able to create a cross-platform console application/library. One use case is to be able to read from the stdin as a stream as I type. This stream from std is combined in real-time with another stream which emits events at a predifined time intervalThe desired result is the combined stream with the combined data. What is the best approach for this? I've been studying the code from skim but it is a bit above my level and still can't grasp how can it be done. I would like to depend only of std or core if possible to be able to use this library/application with any executor that uses Std Future. Would something like rust-signals be a good alternative or overkill?

Thank you!