These are chat archives for rust-lang/rust

29th
Aug 2018
John
@gitlabaccount624_gitlab
Aug 29 2018 00:44
what rust password hashing library would you all recommend?
John
@gitlabaccount624_gitlab
Aug 29 2018 02:56
probably just gonna use this i guess https://crates.io/crates/bcrypt/
John
@gitlabaccount624_gitlab
Aug 29 2018 03:20
also, what's a better way of doing this?
    if let Err(_) = &user_hash {
        return HttpResponse::Ok().finish();
    }

    let asdf = user_hash.unwrap();
i want to return from the function if the hash isn't found (user not in db), and then unwrap it and use it later on in the function otherwise
i prefer return guards rather than indenting nesting
Vitaly
@Virtuos86
Aug 29 2018 04:50
if user_hash.is_err() { return HttpResponse::Ok().finish(); };
let asdf = user_hash.unwrap();
A Dinesh
@dineshadepu
Aug 29 2018 05:19
Hello all, where I can find the function iter() which is called on Iterator types.
and also, into_iter(), iter_mut()?
Vitaly
@Virtuos86
Aug 29 2018 06:25
@dineshadepu https://doc.rust-lang.org/std/index.html, use search form
Denis Lisov
@tanriol
Aug 29 2018 08:55
@gitlabaccount624_gitlab
let asdf = match &user_hash {
    Ok(hash) => hash,
    Err(_) => { return HttpResponse::Ok().finish(); }
}
I'd recommend not using unwrap unless you really need it. It is extra mental load for someone reading your code as one needs to reason whether it could panic.
Michal 'vorner' Vaner
@vorner
Aug 29 2018 09:00
Regarding unwrap ‒ I usually (if it's not super obvious) put a comment there why it won't panic or use expect with description.
Santolama
@Santolama
Aug 29 2018 10:41
[35] SSL connect error (schannel: next InitializeSecurityContext failed: Unknown error (0x80092013) - The revocation function was unable to check revocation because the revocation server was offline.)
I kept having this error when compiling my program
using cargo build
neonphlux
@neonphlux
Aug 29 2018 17:19
Good afternon. Is there a way implement the question mark operator for my own types?
If so, could you point me to some resource in the book or something? Thank you.
Michal 'vorner' Vaner
@vorner
Aug 29 2018 17:25
All the operators that can be implemented are traits in std::ops. This one is https://doc.rust-lang.org/std/ops/trait.Try.html. But it's still unstable, so you have to use nightly with feature flags, unfortunately. There are some discussions still going on if the trait behind the ? operator should look exactly like this.
neonphlux
@neonphlux
Aug 29 2018 17:31
Great, thank you very much for your time.
John
@gitlabaccount624_gitlab
Aug 29 2018 21:34
cool thanks @Virtuos86 @tanriol