yewstack / implicit-clone

Immutable types and ImplicitClone trait similar to Copy
19 stars 10 forks source link

Add method implicit_clone() to help ensure the type is ImplicitClone #44

Closed cecton closed 1 year ago

cecton commented 1 year ago

Following the advice of @kirillsemyonkin, I'm adding a function implicit_clone() which will enforce that the type is implementing ImplicitClone while still actually cloning.

Related to https://github.com/yewstack/yew-autoprops/pull/10#discussion_r1382610834

cecton commented 1 year ago

screenshot3

kirillsemyonkin commented 1 year ago

i meant a non-impl fn outside of anything (fn implicit_clone<T: ImplicitClone> instead of fn implicit_clone(&self)), but if this works for your usecase i guess it might work

cecton commented 1 year ago

@kirillsemyonkin yes I know what you meant but I thought this would be better. What do you think?