Skip to content

Passing self to an external method #72

Description

@rkjnsn

I have a struct Foo that I'm trying to mock with faux. One of the methods has something like this:

#[cfg_attr(test, faux::methods)]
impl Foo {
    pub async fn method(&self) {
        Bar::method(self).await; // Error: Bar::method expects &Foo, but self is &_FauxOriginal_Foo.
    }
}

Ideally, faux would do some magic here to pass Bar::method a reference to the outer &Foo enum without any code changes, but in the interim, is there any way to make this work?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions