Macro impl_display_from_string_field

Source
macro_rules! impl_display_from_string_field {
    ($struct_name:ident, $field:ident) => { ... };
}
Expand description

Implement Display trait for a struct that has a field of type String.

impl std::fmt::Display for BookmarkBlock {
    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
        write!(f, "{}", self.url)
    }
}

↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓

crate::impl_display_from_string_field!(BookmarkBlock, url);