On 8 November 2013 23:10, Oren Ben-Kiki <[email protected]> wrote: > Yes, the down side is another level of indirection. This could be optimized > away for &'static str, but not for &str. Good point.
The level of indirection comes from passing strings as &str, not just as a plain str. But this raises the question. For immutable values implementing &T parameter as T should not be observable from the safe code, right? If so why not to declare that &T as a parameter is not a pointer but rather a hint to use the fastest way to pass an instance of T to the function. Then one can use &str as a parameter without any performance impact due to indirection even if str itself is fixed-sized 3-word block pointing to the heap allocated data. _______________________________________________ Rust-dev mailing list [email protected] https://mail.mozilla.org/listinfo/rust-dev
