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
There are often situations where you need similar-but-distinct names for functions that allow you to
convert &self to &T for some T != Self
convert self to T for some T != Self
copy &self to T for some T != Self
Those functions at the moment are named in a very ad-hoc fashion: to_bytes(), slice_str(), as_char(), to_bytes_consume() etc. A standard naming convention would allow to see at a glance what the function does.
One possible set of names could be:
to_TYPE() for a copy/new allocation.
as_TYPE() for a reference/slice.
into_TYPE() for consuming self and returning the target type without copy.
The text was updated successfully, but these errors were encountered:
There are often situations where you need similar-but-distinct names for functions that allow you to
&self
to&T
for someT != Self
self
toT
for someT != Self
&self
toT
for someT != Self
Those functions at the moment are named in a very ad-hoc fashion:
to_bytes()
,slice_str()
,as_char()
,to_bytes_consume()
etc. A standard naming convention would allow to see at a glance what the function does.One possible set of names could be:
to_TYPE()
for a copy/new allocation.as_TYPE()
for a reference/slice.into_TYPE()
for consuming self and returning the target type without copy.The text was updated successfully, but these errors were encountered: