You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add to_istring() and similar methods to applicable types, so that it is possible to use a more precise method than into(), without using path-ful calls like IString::from(Rc::from(...)).
May aid with #56, but it might also have the implementation collision akin to having both From<&'static str> and From<&'a str>. In this case it might be probable to make the two do different behaviors: .to_istring() would be always cloning/copying, and would always turn &'static str into an IString::Rc. Also consider even more precise to_istring_static and to_istring_rc (these method names might be too verbose).
I'm not really in favor of adding traits because it feels unnecessary but I won't oppose it. implicit-clone is in alpha and if you think this can bring value I think we should try. Worst case scenario we will remove it at the next alpha or before the first stable release.
I just had to add those extension traits in my code using ImplicitClone structures, probably because .into() was not reliable enough. Also helps users to not do str.to_string().into() (when an Rc::from(str).into() would be desired) and do str.to_istring() immediately (although that may be resolved if you make .into() work on any &str anyway)
I've never really bothered that much about performances but I understand the struggle. I did try a few times to convert an &str to an IString and everytime it feels like something that you should be able to do easily instead of being lead into a not optimal solution.
Add
to_istring()
and similar methods to applicable types, so that it is possible to use a more precise method thaninto()
, without using path-ful calls likeIString::from(Rc::from(...))
.May aid with #56, but it might also have the implementation collision akin to having both
From<&'static str>
andFrom<&'a str>
. In this case it might be probable to make the two do different behaviors:.to_istring()
would be always cloning/copying, and would always turn&'static str
into anIString::Rc
. Also consider even more preciseto_istring_static
andto_istring_rc
(these method names might be too verbose).Also consider
.collect_iarray()
and similar, akin to itertools'scollect_vec
.The text was updated successfully, but these errors were encountered: