+
Skip to content

non-generic methods that use their generic structs' lifetime parameters #656

@jason-alt2

Description

@jason-alt2

Not sure if this is possible to handle currently but mockall doesn't seem able to handle lifetimes on a structure within a mock! macro call (see below)

mock! {
    pub Foo<'a> {
        pub fn new(value: SomeType<'a>) -> Self;
    }
}

The above will give you that 'a is an undeclared lifetime no matter how you do it (you can do it on the function only but In my case Im using mockall double so places in my codebase break as its expecting the mock to take in a lifetime too but it doesn't)

I also can't use automock (which I think can handle this case) as I need a custom name and I need to be able to handle deriving inherited traits like Clone.

If this is something that isn't supported Im happy to look into it with a point in the right direction. (Assuming its feasible)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载