Thanks Huon, that really cleared things up for me.
Dum question: What's the reason for str being a special fat pointer as a
language feature rather than just a vanilla struct? E.g. struct StrSliceT
{start: T, length: uint}
(I suppose this question also applies to [T])
On Mon, Mar 24, 2014 at
Oops, I sent that before I finished editing it. I meant struct StrSlice
{start: u8, length: uint}
On Tue, Mar 25, 2014 at 4:33 PM, Phil Dawes rustp...@phildawes.net wrote:
Thanks Huon, that really cleared things up for me.
Dum question: What's the reason for str being a special fat pointer
To complete my understanding: is there a reason a 'sufficiently smart
compiler' in the future couldn't do this conversion implicitly?
I.e. if a function takes a borrowed reference to a container of pointers,
could the compiler ignore what type of pointers they are (because they
won't be going out
It would be necessary (but not sufficient*) for them to have the same
in-memory representation, and currently ~str and str don't.
~str is `*{ length: uint, capacity: uint, data... }`, a pointer to a
vector with the length and capacity stored inline, i.e. one word; str
is just `{ data: *u8,
On 3/23/14 12:11 AM, Phil Dawes wrote:
On Sun, Mar 23, 2014 at 2:04 AM, Patrick Walton pcwal...@mozilla.com
mailto:pcwal...@mozilla.com wrote:
Why not change the signature of `search_crate` to take `~str`?
Patrick
Hi Patrick,
The main reason I haven't done this is that it is already
On 23/03/14 18:14, Patrick Walton wrote:
On 3/23/14 12:11 AM, Phil Dawes wrote:
On Sun, Mar 23, 2014 at 2:04 AM, Patrick Walton pcwal...@mozilla.com
mailto:pcwal...@mozilla.com wrote:
Why not change the signature of `search_crate` to take `~str`?
Patrick
Hi Patrick,
The main reason
Great, thanks Patrick + Huon
On Sun, Mar 23, 2014 at 7:47 AM, Huon Wilson dbau...@gmail.com wrote:
On 23/03/14 18:14, Patrick Walton wrote:
On 3/23/14 12:11 AM, Phil Dawes wrote:
On Sun, Mar 23, 2014 at 2:04 AM, Patrick Walton pcwal...@mozilla.com
mailto:pcwal...@mozilla.com wrote:
Hello!,
I'm learning rust and finding myself fighting the language a little and so
I could do with a bit of help.
In my code completion project I have a function which parses 'use' view
items (using libsyntax) and currently returns a vector of vectors of
strings representing fully qualified