#[derive(HasId)]
{
// Attributes available to this derive:
#[id_field]
#[has_id]
}
Expand description
Implement the configured DBC HasId trait for a named-field structure.
ยงExample
mod support {
pub trait HasId {
fn id(&self) -> i32;
}
}
use support::HasId as _;
use wowlab_engine_macros::HasId;
#[derive(HasId)]
#[id_field = "record_id"]
#[has_id(crate = "crate::support")]
struct Row {
record_id: i32,
}
fn main() {
assert_eq!(Row { record_id: 42 }.id(), 42);
}