Stream: t-libs/wg-allocators

Topic: Allocator aware std traits

Sydney Acksman (Sep 16 2019 at 16:03, on Zulip):

There's a number of traits that implicitly allocate to the global allocator like str ToOwned making a String<Global> and Clone String<Global> always making another String<Global> which would make it slightly more difficult to move data across allocators.

let a: String<Global> = format!("hello world!");
let b: String<System> = a.clone(); // nope, that's a String<Global>
let b: String<System> = { // we could do it manually
    let mut z: String<System> = String::new();
let b: String<System> = a.clone_in(System); // or use a trait

let s: &'static str = "hello world!";
let t: String<Global> = s.to_owned();
let u: String<System> = s.to_owned(); // nope, it's Global again
let v: String<System> = s.to_owned_in(System);

Is there an issue yet talking about traits like this?

gnzlbg (Sep 16 2019 at 22:18, on Zulip):


Last update: Jul 03 2020 at 15:55UTC