pub struct ModelMeta {
pub model: &'static str,
pub table: &'static str,
pub fields: &'static [&'static str],
pub columns: &'static [&'static str],
}Expand description
Metadata about a Model implementor.
Can be retrieved via the Model::metadata and Model::metadata_dyn methods.
Fields§
§model: &'static strThe name of the model type.
§Example
#[derive(Model)]
#[table("foos")]
pub struct Foo {
pub field: String
}
assert_eq!("Foo", Foo::metadata().model)table: &'static strThe name of the model table.
§Example
#[derive(Model)]
#[table("foos")]
pub struct Foo {
pub field: String
}
assert_eq!("foos", Foo::metadata().table)fields: &'static [&'static str]The field names of the model type, in order of their definition.
§Example
#[derive(Model)]
#[table("foos")]
pub struct Foo {
pub bar: String,
pub qux: String,
}
assert_eq!(&["bar", "qux"], Foo::metadata().fields)columns: &'static [&'static str]The columns of the model table.
§Example
#[derive(Model)]
#[table("foos")]
pub struct Foo {
pub bar: String,
#[column("baz")]
pub qux: String,
}
assert_eq!(&["bar", "baz"], Foo::metadata().columns)Trait Implementations§
impl Eq for ModelMeta
impl StructuralPartialEq for ModelMeta
Auto Trait Implementations§
impl Freeze for ModelMeta
impl RefUnwindSafe for ModelMeta
impl Send for ModelMeta
impl Sync for ModelMeta
impl Unpin for ModelMeta
impl UnwindSafe for ModelMeta
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more