You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I'm trying to mock a function named lookup_addr which belongs to an external crape (dns-lookup) in order to avoid DNS resolution timeouts during tests, etc.
error[E0308]: mismatched types
--> src/ip.rs:175:9
|
175 | mock_method!(lookup_addr(&self, ip: &IpAddr) -> Result<String, ()>);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `&std::net::IpAddr`, found enum `std::net::IpAddr`
|
= note: this error originates in the macro `mock_method` (in Nightly builds, run with -Z macro-backtrace for more info)
Any idea on what I'm doing wrong?
I also tried with mock_func_no_default!() but my custom function was never called.
Also, if I remove the &'static from the macro call abose, it complains that it expects a named lifetime.
Thx.
The text was updated successfully, but these errors were encountered:
Rust: stable/1.60 on macOS 14.6 in a Mac Mini.
Hello, I'm trying to mock a function named
lookup_addr
which belongs to an external crape (dns-lookup
) in order to avoid DNS resolution timeouts during tests, etc.Trying the
Trait
approach, I get this:and it always barf with this error message:
Any idea on what I'm doing wrong?
I also tried with
mock_func_no_default!()
but my custom function was never called.Also, if I remove the
&'static
from the macro call abose, it complains that it expects a named lifetime.Thx.
The text was updated successfully, but these errors were encountered: