On Tue, Feb 04, 2014 at 11:41:21PM -0800, Vadim wrote:
> How does this apply to traits?    If I look at "trait MutableVector<'a, T>"
> there's nothing that would connect 'a and self. 

There is no necessary connection between 'a and the receiver. For
example, you might have:

    impl MutableVector<'static, T> for SomeType<T> { ... }

> But what about dynamic dispatch?  Is the following supposed to
> work?:
> 
> fn bar(x: &mut MutableVector<int>) {
>     let y = x.mut_iter();
>     ...
> }

This should work ok. If you expand out all the implicit lifetime
parameters in this example, you would have a function like:

> fn bar<'a,'b>(x: &'b mut MutableVector<'a, int>) {
>     let y = x.mut_iter();
>     ...
> }

Now a function like `mut_iter()` should get an iterator with lifetime
`'a`.


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

Reply via email to