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

Add #[require] macro (or different name) #5

Open
AldaronLau opened this issue Jul 23, 2023 · 1 comment
Open

Add #[require] macro (or different name) #5

AldaronLau opened this issue Jul 23, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@AldaronLau
Copy link
Member

AldaronLau commented Jul 23, 2023

Required traits are like supertraits, except that if they are not object safe, they do not compromise the object safety of the subtrait.

@AldaronLau AldaronLau added the enhancement New feature or request label Jul 29, 2023
@AldaronLau
Copy link
Member Author

AldaronLau commented Jul 29, 2023

Better API:

#[require(Clone)]
pub trait Trait {
    fn clone_boxed(self: &impl Clone + 'static) -> Box<dyn Trait> {
        Box::new(self.clone())
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant