of_method

Macro of_method 

Source
macro_rules! of_method {
    ($ty:ident :: $method:ident) => { ... };
}
Expand description

Get the name of the given method.

This macro resolves Self to the appropriate type when used inside an impl block.

This macro checks that the method exists on the given type. If either the type or method is renamed via refactoring tools, the macro call will be updated accordingly.

ยงExamples

struct MyStruct;
impl MyStruct {
    fn my_method(&self) {}
}
assert_eq!(pretty_name::of_method!(MyStruct::my_method), "MyStruct::my_method");