我想使用error[E0277]: the trait bound `std::error::Error + 'static: std::marker::Send` is not satisfied
--> src/main.rs:35:5
|
35 | / error_chain!{
36 | |
37 | | foreign_links {
38 | | Mqttc(::mqttc::Error);
... |
53 | | }
54 | | }
| |_____^ `std::error::Error + 'static` cannot be sent between threads safely
|
= help: the trait `std::marker::Send` is not implemented for `std::error::Error + 'static`
= note: required because of the requirements on the impl of `std::marker::Send` for `std::ptr::Unique<std::error::Error + 'static>`
= note: required because it appears within the type `std::boxed::Box<std::error::Error + 'static>`
= note: required because it appears within the type `mqttc::netopt::Error`
= note: required because it appears within the type `mqttc::Error`
= note: required because it appears within the type `errors::ErrorKind`
= note: required because it appears within the type `errors::Error`
= note: required by `error_chain::ChainedError`
= note: this error originates in a macro outside of the current crate
读取带有中文字符的文件。我可以使用readLines()并指定readChar()
,但使用encoding = "UTF-8"
会使事情变得更容易。
有什么方法可以修改函数readChar()
,或者创建一个新函数,以允许指定编码?