of_field

Macro of_field 

Source
macro_rules! of_field {
    ($ty:ident $(::<$($arg:ty),*>)? :: $field:ident) => { ... };
}
Expand description

Get the name of the given struct field.

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

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

ยงExamples

struct MyStruct {
    my_field: i32,
}
assert_eq!(pretty_name::of_field!(MyStruct::my_field), "MyStruct::my_field");