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
{{ message }}
This repository was archived by the owner on Aug 15, 2025. It is now read-only.
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.com-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`