You can also read and search the docs and easily see the Implementors (and
even click on them to get more detailed documentation AND even have 1 click
access to the [src] ) :

http://doc.rust-lang.org/0.10/std/to_str/trait.ToStr.html

If you find the docs are lacking a bit, then let the maintainers know
(there is ongoing effort to improve the docs by the way...even a few newly
hired folks at Mozilla).



On Wed, May 28, 2014 at 8:23 PM, Sean McArthur <[email protected]>wrote:

>
>
>
> On Wed, May 28, 2014 at 5:38 PM, Oleg Eterevsky <[email protected]>wrote:
>
>> 3. It seems like almost any string operation requires as_slice().
>> Can't various string methods be also implemented for String?
>>
>
> When writing functions for others to use, you don't want to require them
> to have a String, since that requires a heap allocation. It's free to go
> from String to a slice, but not vice-versa. That said, there's been
> whispers of making String implement Deref, as well passing as arguments to
> autoderef, so you could pass a String and rustc would convert to a slice
> for you.
>
>
>> 5. Simple indexing doesn't work for vectors:
>>   let a = vec![1, 2, 3];
>>   println!("{}", a[0]);
>> It's a bit surprising...
>>
>
> Known issue: https://github.com/mozilla/rust/issues/11875
>
>
>>
>> 6. impl ToStr for custom struct fails:
>>   error: conflicting implementations for trait `std::to_str::ToStr`
>>   note: conflicting implementation in crate `std`
>> Is it a bug? Is Show implicitly assumed for all struct's?
>>
>
> This is because ToStr is implemented for all Show implementations. You
> can't implement ToStr, because if you then implemented Show, you'd have
> conflicting implementations. #[deriving(Show)] on your structs is probably
> all you want.
>
>
> _______________________________________________
> Rust-dev mailing list
> [email protected]
> https://mail.mozilla.org/listinfo/rust-dev
>
>


-- 
-Thad
+ThadGuidry <https://www.google.com/+ThadGuidry>
Thad on LinkedIn <http://www.linkedin.com/in/thadguidry/>
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to