Great Thanks to all,
now i have a more precise idea.
So, to summarize
if the function takes a vector as argument, transforms it, and return it,
with no need for the caller to use the argument
fn my_func(src: Vecu8) - Vecu8
if the functons takes a vector argument and use it just for a temporary
Hello all,
I've read this :
http://words.steveklabnik.com/pointers-in-rust-a-guide
I am coming from Java where everything is passed and returned by
reference (except for primitive data types), no choice.
I know that with C, you have to use pointers to avoid passing and
returning by value.
When
On 01/06/14 04:34 AM, Christophe Pedretti wrote:
Hello all,
I've read this :
http://words.steveklabnik.com/pointers-in-rust-a-guide
I am coming from Java where everything is passed and returned by
reference (except for primitive data types), no choice.
I know that with C, you have to
Aw, Gmail makes it so easy to press Reply instead of Reply to all.
See below :)
Hi, Christophe,
Because `Vec` looks like this:
struct VecT {
len: uint,
cap: uint,
data: *mut T
}
its actual size is just three words, so you can freely pass it around
regardless of number of
one of the recent changes with box is that it does placement new. So
generally, this is bad:
fn foo(x: int) - Boxint {
box (x + 1)
}
let y = foo(5);
Because it forces your caller to use a Box. Instead...
fn foo(x: int) - int {
x + 1
}
Because then your caller can choose:
let y =