Skip to content

How do I use mockall in a struct that derives Clone? #308

Answered by asomers
augustocdias asked this question in Questions
Discussion options

You must be logged in to vote

The way you specified it, Mockall doesn't know that MyStruct is supposed to be Clone. Instead, do it like this:

mock! {
    MyStruct {}
    impl Clone for MyStruct {
        fn clone(&self) -> Self;
    }
}

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@augustocdias
Comment options

@asomers
Comment options

@augustocdias
Comment options

@asomers
Comment options

@augustocdias
Comment options

Answer selected by augustocdias
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants