How to get a struct from a syn::ImplItemMethod

I have a ImplItemMethod in syn - Rust. How do I get the struct that it implements for?

For example:

pub struct StructWithMethod{
    something: String
}

impl StructWithMethod {
    pub fn do_something(&self, _u: u32) {
        todo!()
    }
}

I was able to find do_something but I don't see a way to get the struct StructWithMethod from its fields

The ImplItemMethod is just this part

    pub fn do_something(&self, _u: u32) {
        todo!()
    }

you can't get anything else out of it. What are you trying to do?

3 Likes

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.