Skip to content

Can mockall be used to mock a fn of an external crate #445

Answered by asomers
zephod77 asked this question in Questions
Discussion options

You must be logged in to vote

Is zmq::Socket a struct or a trait? Because what you wrote assumes that it's a trait. And if you fix that , then what it will create is a struct with the same API as the real struct, but it can't be passed to functions expecting the real struct. So you need to make the substitution at compile time. First fix your trait/struct confusion and then the next step will be more obvious.

Replies: 1 comment 16 replies

Comment options

You must be logged in to vote
16 replies
@zephod77
Comment options

@zephod77
Comment options

@asomers
Comment options

@zephod77
Comment options

@asomers
Comment options

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