3 ms·
Totally. It works the same way: it's gotta be behind a pointer. Arc<str> would be a signature for a threadsafe interned string, for example. use std::sync:
by steveklabnik 6y ago
Totally. It works the same way: it's gotta be behind a pointer. Arc<str> would be a signature for a threadsafe interned string, for example.
use std::sync::Arc;
fn foobar(s: &str) -> Arc<str> {
Arc::from(s.to_string())
}
You almost always can only create these sorts of values by casting.