Skip to main content

Module

Trait Module 

Source
pub trait Module: Sized {
    // Required method
    fn name(&self) -> ModuleName;

    // Provided methods
    fn table(&self) -> Option<TableName> { ... }
    fn fields(&self) -> Fields { ... }
    fn configure_table(&self, table: TableSpec) -> TableSpec { ... }
    fn actions(&self) -> Actions { ... }
    fn views(&self) -> Vec<ViewSpec> { ... }
    fn into_spec(self) -> ModuleSpec { ... }
}
Expand description

业务 Module:fields/actions/views 仍集中在同一个实现中。

Required Methods§

Source

fn name(&self) -> ModuleName

返回全限定 Module 名。

Provided Methods§

Source

fn table(&self) -> Option<TableName>

返回可选数据库表名。

Source

fn fields(&self) -> Fields

返回主表字段。

Source

fn configure_table(&self, table: TableSpec) -> TableSpec

在统一字段投影后补充表标题、复合索引等表级约束。

Source

fn actions(&self) -> Actions

返回 Module Actions。

Source

fn views(&self) -> Vec<ViewSpec>

返回显式 Views;空集合由构建器生成默认 View。

Source

fn into_spec(self) -> ModuleSpec

直接聚合为唯一 ModuleSpec,不经过兼容投影。

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§