Try using `self.sgf.as_slice()` instead.

The change is necessary, AFAIK, because `~str` would automatically be
converted to a borrowed reference without having to explicitly call the
`as_slice` method. This doesn't happen for the StrBuf (and what is now
String, I think) type.

My suspicion is that the automatic conversion will come back at some
point, but I'm not sure.

- Andrew


On Mon, May 26, 2014 at 2:32 AM, Urban Hafner <[email protected]> wrote:
> Hello there,
>
> I just updated the compiler (I use the git master branch) and now when I
> read in a file I get a StrBuf instead of a ~str. That is easy enough to
> change, but how do I use regular expressions now? I have the following in my
> code:
>
> let re = regex!(r"SZ\[(\d+)\]");
> let captures = re.captures(self.sgf).unwrap();
>
> And it fails now because "self.sgf" is a StrBuf instead of a &str. Do I have
> just a Rust compiler that is somewhere in between (i.e. not everything has
> been changed to StrBuf) or is this intentional? And if so, what's the best
> way to use regular expressions now?
>
> Urban
> --
> Freelancer
>
> Available for hire for Ruby, Ruby on Rails, and JavaScript projects
>
> More at http://urbanhafner.com
>
> _______________________________________________
> Rust-dev mailing list
> [email protected]
> https://mail.mozilla.org/listinfo/rust-dev
>
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to