You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Arc<str> can't be bincoded with bincode 2. See code and error message below. Arc<&str> works though. Link to gist at bottom.
use std::sync::Arc;use bincode;fnmain(){let val:Arc<str> = std::sync::Arc::from("Example String");let config = bincode::config::standard();let encoded = bincode::encode_to_vec(val, config).unwrap();for byte in encoded {print!(" {byte:02x}");}println!();}
compiled on rustc 1.61.0-nightly (58f11791a 2022-03-17) on MacOS gives:
error[E0277]: the size for values of type `str` cannot be known at compilation time
--> minimal_example/src/main.rs:7:40
|
7 | let encoded = bincode::encode_to_vec(val, config).unwrap();
| ---------------------- ^^^ doesn't have a size known at compile-time
| |
| required by a bound introduced by this call
|
= help: the trait `Sized` is not implemented for `str`
= note: required because of the requirements on the impl of `Encode` for `Arc<str>`
note: required by a bound in `encode_to_vec`
--> /Users/nalp/.cargo/registry/src/github.ghproxy.top-1ecc6299db9ec823/bincode-2.0.0-rc.1/src/features/impl_alloc.rs:42:25
|
42 | pub fn encode_to_vec<E: enc::Encode, C: Config>(val: E, config: C) -> Result<Vec<u8>, EncodeError> {
| ^^^^^^^^^^^ required by this bound in `encode_to_vec`
This is part of a larger issue where we might have to split Decode and BorrowDecode into separate traits. Work is being done in #526 but it's going to be a slow process.
Arc<str>
can't be bincoded with bincode 2. See code and error message below.Arc<&str>
works though. Link to gist at bottom.compiled on rustc 1.61.0-nightly (58f11791a 2022-03-17) on MacOS gives:
https://gist.github.com/nalply/c29385f0046ca03ae0f3a687dfeb24d1
The text was updated successfully, but these errors were encountered: