audunhalland / unimock

A versatile and developer-friendly trait mocking library
MIT License
71 stars 3 forks source link

feat: Bring back AnswerFn with support for parameter borrows #47

Closed audunhalland closed 7 months ago

audunhalland commented 7 months ago

I tried as a test to dog-food the applies API introduced in https://github.com/audunhalland/unimock/pull/43, but found I didn't like it very much. This change brings back the answers API, but without any type magic around its return type, so the respond API has been completely removed. The type returned through AnswerFn is just the same raw type that the trait method returns, and the signature is almost the same. Borrows can be made by using new method Unimock::make_ref.