Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider conversion from borrowed types. #749

Open
jerry73204 opened this issue Jul 19, 2020 · 1 comment
Open

Consider conversion from borrowed types. #749

jerry73204 opened this issue Jul 19, 2020 · 1 comment

Comments

@jerry73204
Copy link

jerry73204 commented Jul 19, 2020

The issue is due to sebcrozet/kiss3d#237. Please consider the following impls.

impl<'a, N, D> From<&'a Point<N, D>> for Cow<'a, Point<N, D>>
impl<'a, N, D> From<Point<N, D>> for Cow<'a, Point<N, D>>
impl<N, D> Borrow<Point<N, D>> for Point<N, D>
impl<'a, N, D> From<&'a Point<N, D>> for Point<N, D>

It helps constructing the API without cloning data around. For example, we may have a function call accepting both owned and borrowed types.

fn add_point<'a>(p: impl Into<Cow<'a, Point3<f32>>>)

EDIT: grammar

@pwnorbitals
Copy link

@sebcrozet Is this considered ?

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

No branches or pull requests

2 participants