[rust-dev] Futures in Rust

Vadim vadimcn at gmail.com
Wed Jan 29 14:39:01 PST 2014


I've tried to simulate that with iterators, but it seems I can still read
the buffer.   This compiles without errors:

    let mut buf = [0, ..1024];
    let mut iter = buf.mut_iter();
    let x = buf[0];
    *iter.next().unwrap() = 2; // just to make sure I can mutate via the
iterator




On Wed, Jan 29, 2014 at 2:06 PM, Daniel Micay <danielmicay at gmail.com> wrote:

> On Wed, Jan 29, 2014 at 5:03 PM, Vadim <vadimcn at gmail.com> wrote:
> >
> > But maybe Rust type system could grow a new type of borrow that prevents
> all
> > object access while it is in scope, similarly to how iterators prevent
> > mutation of the container being iterated?
> >
> > Vadim
>
> An `&mut` borrow will prevent reads not through that borrow.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/rust-dev/attachments/20140129/504556f2/attachment.html>


More information about the Rust-dev mailing list