Macro impl_from_as_ref

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

This macro is used to generate a setter method for a struct field.

crate::impl_from_as_ref!(BookmarkBlock, url);

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

impl<T> From<T> for BookmarkBlock
where
    T: AsRef<str>,
{
    fn from(url: T) -> Self {
        Self::default().url(url)
    }
}