Skip to content

Consider implementing more ops for Ref<T> #35

@chronicl

Description

@chronicl

By implementing

impl<T1, T2> Add<T1> for Ref<T2>
where T2: Add<T1>

// and
impl<T> Add<Ref<T>> for  vec<N, L>
where vec<N, L>: Add<T>

// and similarly for sm::Struct<S>, u32, i32, f32 and so on

for all binary operations, we can massively improve the ergonomics of using Ref.
Would you be open for that?
I implemented it already so I could prepare a PR very quickly.

Also, there is a lot of functions/methods in shame that accept impl To<T> and it would be nice if those accepted Ref<T>. For testing purposes I implemented ToGpuType for Ref<T> which implies impl To<T> for Ref<T> and it works great, but of course that's not the intended way for ToGpuType to be used.

With those two improvements I think Buffer could safely be removed in favor of renaming BufferRef to Buffer.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions