A place for all things related to the Rust programming language—an open-source systems language that emphasizes performance, reliability, and productivity.
Members
•
Free function to trait impl
I have a trait that features 1 single function, let’s call it foo. This function cannot have a self parameter for a specific reason. Now I want types that implement the trait I can create unit structs and implement the trait for it. But this creates much boilerplate for just saying this implementation function is an implementation of this trait. If I could somehow get rid…
A place for all things related to the Rust programming language—an open-source systems language that emphasizes performance, reliability, and productivity.
Members
•
Free function to trait impl
I have a trait that features 1 single function, let’s call it foo. This function cannot have a self parameter for a specific reason. Now I want types that implement the trait I can create unit structs and implement the trait for it. But this creates much boilerplate for just saying this implementation function is an implementation of this trait. If I could somehow get rid of all the boilerplate and just use a free function as a type that implements the trait. I know free functions aren’t types but I need some way to wrap it/treat it as one. Maybe make some macro for it?!