> However, is there an alternative that does not introduce (ref) 
> indirection? Something that would make s in the code below be of type 
> &str instead of ~str?

There is not, today. This is precisely what the recent thread
"dynamically sized types, revisited" is discussing, however.  If that
proposal were to go through, one could do the following:

> fn f<'a>(fb: &'a Foobar) -> &'a str {
>      match *fb {
>          Foo(~ref s) => s,
>          Bar(~ref s) => s
>      }
> }



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

Reply via email to