Macro kvarn::prelude::utils::field_str

source ·
macro_rules! field_str {
    ($self:ident.$field:ident) => { ... };
Expand description

Stringify $field on $self. This only returns the field name. This is constructed to make your IDE recognize the input as the actual field. This means renaming is applied to the string returned from this when you rename a field in your IDE.

This is useful for debug implementations.


use kvarn_utils::field_str;

struct Foo {
    bar: u128,
impl Foo {
    fn name(&self) -> &'static str {

let foo = Foo { bar: 42 };
assert_eq!(, "bar");