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
The SDK contains many conversion functions from one type to another and so on. Some conversions are implemented as .to_*, .into_*, and .from_* functions, while others are implemented as Into/From impls, and then some are implemented as both.
I think we should strive to build some consistency with conversions so that every conversion has:
A .to_ on the source type
A .into_ on the source type if the source can be consumed and that's a meaningful optimisation
A .from_ on the destination type
A From impl on the destination type, or if not possible a Into impl on the source type, that call to .from_/.to_ above
A From/Into impl on the borrowed type
Some of this naming and pattern is derived from the Rust Naming conventions for conversions:
The SDK contains many conversion functions from one type to another and so on. Some conversions are implemented as
.to_*
,.into_*
, and.from_*
functions, while others are implemented asInto
/From
impls, and then some are implemented as both.I think we should strive to build some consistency with conversions so that every conversion has:
.to_
on the source type.into_
on the source type if the source can be consumed and that's a meaningful optimisation.from_
on the destination typeFrom
impl on the destination type, or if not possible aInto
impl on the source type, that call to.from_
/.to_
aboveFrom
/Into
impl on the borrowed typeSome of this naming and pattern is derived from the Rust Naming conventions for conversions:
Ref: https://rust-lang.github.io/api-guidelines/naming.html#ad-hoc-conversions-follow-as_-to_-into_-conventions-c-conv
The text was updated successfully, but these errors were encountered: