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 i read the mentionned guide, things are not so evident with Rust.

So, to be precise, imagine i need to write à fonction which takes à
big Vec<u8> (In my case it´s an SQL BLOB) as argument and returns a
big Vec<u8>

Should i use
Fn my_func(src : &Vec<u8>) -> &Vec<u8>
Fn my_func(src : &Vec<u8>) -> ~Vec<u8>
Fn my_func(src : &Vec<u8>) ->Vec<u8>
Fn my_func(src : Vec<u8>) -> Vec<u8>
Fn my_func(src : ~Vec<u8>) -> ~Vec<u8>
Any other combination ?

Thanks

PS : i know that i have to use lifetimes and that ~ are now Box, i've
omitted them to simplify my demand
PS2 : genrally with a language you can accomplish the same thing with
different methods, but there are also common "usages", even if Rust is
young, what is the usage for passing and returning large data values
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to