pub struct ColumnDef {
pub header: String,
pub aliases: Vec<String>,
pub required: bool,
pub kind: ColumnKind,
pub width: Option<f64>,
pub format: Option<String>,
pub text_format: bool,
pub image: bool,
pub ignore: bool,
pub default: Option<String>,
pub note: Option<String>,
pub dropdown: Vec<String>,
}Expand description
列定义
Fields§
§header: String标准表头(模板/导出使用)
aliases: Vec<String>别名(动态表头适配:历史模板改过列名的场景)
required: bool必填
kind: ColumnKind语义类型
width: Option<f64>导出列宽
format: Option<String>导出数值格式(如 #,##0.00、yyyy-mm-dd)
text_format: bool导出是否按文本格式写(@)
image: bool是否图片列
ignore: bool导入时忽略(仅参与模板/导出展示)
default: Option<String>空值默认值(模板示例行与导入兜底)
note: Option<String>模板备注(写入说明 sheet)
dropdown: Vec<String>模板下拉选项(数据验证)
Implementations§
Source§impl ColumnDef
impl ColumnDef
pub fn new(header: impl Into<String>) -> Self
pub fn alias(self, alias: impl Into<String>) -> Self
pub fn aliases<I, S>(self, list: I) -> Self
pub fn required(self) -> Self
pub fn optional(self) -> Self
pub fn kind(self, kind: ColumnKind) -> Self
pub fn width(self, width: f64) -> Self
pub fn format(self, format: impl Into<String>) -> Self
pub fn image(self) -> Self
pub fn ignore(self) -> Self
pub fn default_value(self, value: impl Into<String>) -> Self
pub fn note(self, note: impl Into<String>) -> Self
pub fn dropdown<I, S>(self, list: I) -> Self
Sourcepub fn is_importable(&self) -> bool
pub fn is_importable(&self) -> bool
是否参与导入解析
Sourcepub fn mark_required(&self) -> bool
pub fn mark_required(&self) -> bool
该列是否需要在模板里标红(必填)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ColumnDef
impl RefUnwindSafe for ColumnDef
impl Send for ColumnDef
impl Sync for ColumnDef
impl Unpin for ColumnDef
impl UnsafeUnpin for ColumnDef
impl UnwindSafe for ColumnDef
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