Skip to main content

Column

Trait Column 

Source
pub trait Column<M>:
    Send
    + Sync
    + Clone {
    // Required methods
    fn name(&self) -> &'static str;
    fn table(&self) -> &'static str;
}
Expand description

字段标记 trait

实现此 trait 的类型作为 Model 字段的类型安全引用。 一个 Column<M> 实例携带:

  • 字段名(name()
  • 所属表名(table(),从 Model 关联)

§实现方式

通常通过 define_columns! 宏自动生成实现,无需手动实现。

Required Methods§

Source

fn name(&self) -> &'static str

返回字段名

Source

fn table(&self) -> &'static str

返回字段所属的表名

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§