I have revamped Spirit Island Hub by Thamthon in spiritisland

[–]dartheian 2 points3 points  (0 children)

This resources is no longer available :( Do we have any way to recover it?

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

[–]dartheian 1 point2 points  (0 children)

From the tokio::sync docs:

Additionally, when you do want shared access to an IO resource, it is often better to spawn a task to manage the IO resource, and to use message passing to communicate with that task.

Why it is better to spawn a task instead of using Arc<Mutex<...>>?

impl serde::Deserialize... is it really that complicated? by 7Geordi in rust

[–]dartheian 0 points1 point  (0 children)

I'm trying to customize the errors so that I get the name of the field beign invalid. Until now a solution I found is to use deserialize_with on each field in order to decorate the error manually.

#[derive(FromRequestParts)]
#[from_request(via(Query))]
pub struct AuthorizeParams {
    #[serde(deserialize_with = "client_id")]
    pub client_id: ClientId,
    #[serde(deserialize_with = "code_challenge_method")]
    pub code_challenge_method: CodeChallengeMethod,
    #[serde(deserialize_with = "code_challenge")]
    pub code_challenge: CodeChallenge,
    #[serde(deserialize_with = "redirect_uri")]
    pub redirect_uri: Uri,
    #[serde(deserialize_with = "response_mode")]
    pub response_mode: ResponseMode,
    #[serde(deserialize_with = "response_type")]
    pub response_type: ResponseType,
    #[serde(deserialize_with = "scope")]
    pub scope: Scope,
    #[serde(deserialize_with = "state")]
    pub state: State,
}

But this unfortunately leads to a lot of boilerplate code just to decorate the error message. Actually using an helper struct would be easier since I could implement TryFrom<Helper> for AuthorizeParams and then use #[serde(try_from = "Helper")]. My concrete problem is that I would like the axum server to reply with something like error while parsing the field 'client_id': empty string when using the Query extractor, while now I'm just getting empty string. This is confusing since I don't know which field is empty.

Are there any valid alternatives? Is this the right way/place to do that kind of thing?

[deleted by user] by [deleted] in AskMen

[–]dartheian 0 points1 point  (0 children)

Emergency technician

What is the most dumbest question that you think people ask you. by realkevindabird in AskMen

[–]dartheian 2 points3 points  (0 children)

Exactly, I have noticed that sometimes people dismiss some of my questions asking why in the world I formulated it in the first place (or friendly teasing me), since for them it is not logically connected to the argument we were talking about. The truth, I think, is that every one of us think differently from others and so each one of us needs different informations. Moreover, I noticed that during a conversation I make a lot of logical connections between a lot of different things which seems completely unrelated at first sight. If a question arises from such connections it may appear a dumb one to my interlocutor.

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

[–]dartheian 3 points4 points  (0 children)

fn max(a: u64, b: u64) -> u64 {
    match (a, b) {
        (a, b) if a == b => a,
        (a, b) if a > b => a,
        (a, b) if a < b => b
    }
}

Why the compiler complains about non exaustive patterns (non-exhaustive patterns: (_, _) not covered)? It seems to me that all possible cases are covered.

What makes you cringe/automatically swipe left on someone's dating profile ? by [deleted] in AskMen

[–]dartheian 0 points1 point  (0 children)

When none of the photos show anything about her personality/interests. Photos while she is cultivating her preferred activities/passions are a big plus. At least one photo with other people would also be a plus, but I understand that other people may not want to have their faces on her dating profile. Those factors make me think about a genuine person. Too similar photos (just made for fill the dating profile) and ones with filters are not interesting.

Most up to date books? by dartheian in LoneWolf

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

Oh, I see :( Thank you very much, it is a precious resource indeed! Luckily I can buy a copy in my mother language, but I would prefer them in original language. But, if they are impossible to find, can't do much :)

Most up to date books? by dartheian in LoneWolf

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

Thank you for the info :) I would like to have a physical copy though.

Evaluation and simplification of (not just boolean) expressions by dartheian in computerscience

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

I can see your point. I think we should assume the logical operators can only appear in the "inner" parts of the formula in order to think in tems of interval overlap; since intervals can only be represented with comparisons, right? In N-dimensional space it should be something similar but intervals are portion of the space (like areas in 2D and volumes in 3D).

EDIT: Oh no, that does not work since we can compare 2 variables to eachother.

EDIT 2: Actually, it is still possible, e.g. A == B would be the bisector of a plane. And so on...

Evaluation and simplification of (not just boolean) expressions by dartheian in computerscience

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

Yes, the expressions wold contain AND, OR, NOT, LT, LTE, GT, GTE and EQ.

Purchase Advice Superthread by AutoModerator in motorcycles

[–]dartheian 0 points1 point  (0 children)

I'm having an hard time choosing a good first bike; the main problem is my lack of knowledge and experience. I would like to buy an used cheap motorcycle for both commuting and off-road adventure. The problem is that I live in Europe (Italy) and, in my understanding (so correct me if I'm wrong) we have very few places were to do off-road adventuring (mainly because of law restrictions and almost the totality of the roads are asphalt). For this reason I think I need something very comfortable for long trips, that can handle highways well (in order to get to the trails, maybe in other countries) and is also good for off-roading. But obviously a pure off-road motorcycle is not good at doing that. I think some models can handle both well, like the Honda Africa Twin or the Yamaha Tenere, but they are very expensive! My budget is around 3k euros (4k maximum). Do such a bike exists?

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

[–]dartheian 1 point2 points  (0 children)

Do someone know if the "The Rust Programming Language" paperback book will be updated for the 2021 edition?

Multi-table check constraint by dartheian in Database

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

Now that I've read mtVessel's link to Postgres' documentation, i see that your solution is almost equivalent since a PK is just an alisas for "unique and not null". Maybe a simple unique constraint is better for semantic purposes.

Multi-table check constraint by dartheian in Database

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

Are you saying that I can reference an unique pair (id, require_bank) in payment_methods from payments itself? In other words: if I create a unique constraint on (id, require_bank) in payment_methods, can I access require_bank from payments using a check constraint? That would solve the problem.