dylan-dpc-zz / crypt3 Goto Github PK
View Code? Open in Web Editor NEWRust version of crypt3
License: Apache License 2.0
Rust version of crypt3
License: Apache License 2.0
I have a main function which returns anyhow::Result<()>
and I'm getting the following error when using the ?
operator with crypt
:
let result = crypt(password.as_bytes(), &user_pwd.pw_passwd.as_bytes())?;
error[E0277]: the size for values of type `dyn std::error::Error` cannot be known at compilation time
--> src/bin/passwd.rs:413:76
|
413 | let result = crypt(password.as_bytes(), &user_pwd.pw_passwd.as_bytes())?;
| ^ doesn't have a size known at compile-time
|
= help: the trait `Sized` is not implemented for `dyn std::error::Error`
= help: the following other types implement trait `FromResidual<R>`:
<Result<T, F> as FromResidual<Yeet<E>>>
<Result<T, F> as FromResidual<Result<Infallible, E>>>
= note: required for `Box<dyn std::error::Error>` to implement `std::error::Error`
= note: required for `anyhow::Error` to implement `From<Box<dyn std::error::Error>>`
= note: required for `Result<(), anyhow::Error>` to implement `FromResidual<Result<Infallible, Box<dyn std::error::Error>>>`
error[E0277]: `dyn std::error::Error` cannot be sent between threads safely
--> src/bin/passwd.rs:413:76
|
413 | let result = crypt(password.as_bytes(), &user_pwd.pw_passwd.as_bytes())?;
| ^ `dyn std::error::Error` cannot be sent between threads safely
|
= help: the trait `Send` is not implemented for `dyn std::error::Error`
= help: the following other types implement trait `FromResidual<R>`:
<Result<T, F> as FromResidual<Yeet<E>>>
<Result<T, F> as FromResidual<Result<Infallible, E>>>
= note: required for `Unique<dyn std::error::Error>` to implement `Send`
note: required because it appears within the type `Box<dyn Error>`
--> /home/amiculas/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/boxed.rs:195:12
|
195 | pub struct Box<
| ^^^
= note: required for `anyhow::Error` to implement `From<Box<dyn std::error::Error>>`
= note: required for `Result<(), anyhow::Error>` to implement `FromResidual<Result<Infallible, Box<dyn std::error::Error>>>`
error[E0277]: `dyn std::error::Error` cannot be shared between threads safely
--> src/bin/passwd.rs:413:76
|
413 | let result = crypt(password.as_bytes(), &user_pwd.pw_passwd.as_bytes())?;
| ^ `dyn std::error::Error` cannot be shared between threads safely
|
= help: the trait `Sync` is not implemented for `dyn std::error::Error`
= help: the following other types implement trait `FromResidual<R>`:
<Result<T, F> as FromResidual<Yeet<E>>>
<Result<T, F> as FromResidual<Result<Infallible, E>>>
= note: required for `Unique<dyn std::error::Error>` to implement `Sync`
note: required because it appears within the type `Box<dyn Error>`
--> /home/amiculas/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/boxed.rs:195:12
|
195 | pub struct Box<
| ^^^
= note: required for `anyhow::Error` to implement `From<Box<dyn std::error::Error>>`
= note: required for `Result<(), anyhow::Error>` to implement `FromResidual<Result<Infallible, Box<dyn std::error::Error>>>`
Using an error type derived with thiserror would solve this issue.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.