If you prefer to think about &str, ~str, and @str as separate types, an analogy to C++ might be helpful:

&T is like T *.
~T is like std::auto_ptr<T> in C++03 or std::unique_ptr<T> in C++0x.
@T is like std::shared_ptr<T>.

&str is like char *.
~str is like std::string.
@str is like CString in Microsoft's ATL (reference counted).

&[T] is like a (T *, size_t length) pair.
~[T] is like std::vector<T>.
@[T] is like std::shared_ptr<std::vector<T>>, but without the extra level of indirection.

Essentially, it's like C++ with several of the most common smart pointer types made type-safe and built into the language.

Patrick

_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to