[rust-dev] Passing arguments bu reference

Christophe Pedretti christophe.pedretti at gmail.com
Mon Jun 2 10:49:38 PDT 2014


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: Vec<u8>) -> Vec<u8>

if the functons takes a vector argument and use it just for a temporary
read access, with the need for the caller to use the argument (it was just
a borrow by the fcuntion)
fn my_func(src: &[u8]) -> Vec<u8>

-- 
Christophe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/rust-dev/attachments/20140602/f704e1cf/attachment.html>


More information about the Rust-dev mailing list