Skip to content

Conversation

@adamreichold
Copy link

Having a T: Into<String> bound at the API boundaries is convenient but it implies a certain overhead if the implementation is monomorphized multiple times even though there is not functional difference to whether it has access to T or just &str.

More generally speaking, using &str as the public type might be a better choice in any case as the implementation does not use ownership of T anywhere and taking a string slice would there offer the most efficient API contract, but that would be a braking change and hence I did not make it here.

Having a `T: Into<String>` bound at the API boundaries is convenient but it
implies a certain overhead if the implementation is monomorphized multiple times
even though there is not functional difference to whether it has access to `T`
or just `&str`.

More generally speaking, using `&str` as the public type might be a better
choice in any case as the implementation does not use ownership of `T` anywhere
and taking a string slice would there offer the most efficient API contract,
but that would be a braking change and hence I did not make it here.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant