Skip to main content

DocValue

Enum DocValue 

Source
#[non_exhaustive]
pub enum DocValue { String(String), Bool(bool), Int(i64), Float(f64), DateTime(DateTime<Utc>), Date(NaiveDate), NaiveDateTime(NaiveDateTime), Empty, RichText(Vec<RichRun>), Image(ImageData), }
Expand description

通用文档值 – Rust 类型与 DOCX 内容之间的桥梁。

每个 DocConverter 都从此枚举读取或写入,正如 CellValue 在 Rust 类型与 Excel 单元格数据之间充当中介。

对应 Java: com.alibaba.excel.metadata.data.CellValue / ReadCellData / WriteCellData

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

String(String)

纯文本字符串。

§

Bool(bool)

布尔值。

§

Int(i64)

64 位有符号整数。

§

Float(f64)

64 位浮点数。

§

DateTime(DateTime<Utc>)

UTC 日期时间。

§

Date(NaiveDate)

仅日期(无时间分量)。

§

NaiveDateTime(NaiveDateTime)

无时区的日期时间。

§

Empty

空值 / null。

§

RichText(Vec<RichRun>)

富文本(格式化文本片段)。

§

Image(ImageData)

图片数据(原始字节 + 元数据)。

Trait Implementations§

Source§

impl Clone for DocValue

Source§

fn clone(&self) -> DocValue

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for DocValue

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl From<&str> for DocValue

Source§

fn from(v: &str) -> DocValue

Converts to this type from the input type.
Source§

impl From<DateTime<Utc>> for DocValue

Source§

fn from(v: DateTime<Utc>) -> DocValue

Converts to this type from the input type.
Source§

impl From<NaiveDate> for DocValue

Source§

fn from(v: NaiveDate) -> DocValue

Converts to this type from the input type.
Source§

impl From<NaiveDateTime> for DocValue

Source§

fn from(v: NaiveDateTime) -> DocValue

Converts to this type from the input type.
Source§

impl<T> From<Option<T>> for DocValue
where T: Into<DocValue>,

Source§

fn from(v: Option<T>) -> DocValue

Converts to this type from the input type.
Source§

impl From<String> for DocValue

Source§

fn from(v: String) -> DocValue

Converts to this type from the input type.
Source§

impl From<bool> for DocValue

Source§

fn from(v: bool) -> DocValue

Converts to this type from the input type.
Source§

impl From<f64> for DocValue

Source§

fn from(v: f64) -> DocValue

Converts to this type from the input type.
Source§

impl From<i32> for DocValue

Source§

fn from(v: i32) -> DocValue

Converts to this type from the input type.
Source§

impl From<i64> for DocValue

Source§

fn from(v: i64) -> DocValue

Converts to this type from the input type.
Source§

impl From<u32> for DocValue

Source§

fn from(v: u32) -> DocValue

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.