pub struct PostListItem {Show 14 fields
pub id: i32,
pub author_id: i32,
pub title: String,
pub slug: String,
pub summary: Option<String>,
pub status: PostStatus,
pub published_at: Option<DateTime<Utc>>,
pub created_at: DateTime<Utc>,
pub updated_at: DateTime<Utc>,
pub deleted_at: Option<DateTime<Utc>>,
pub tags: Vec<String>,
pub cover_image: Option<String>,
pub reading_time: u32,
pub word_count: u32,
}Expand description
文章列表项 DTO。
仅包含列表/标签/搜索/归档等场景需要的字段,不含 content_md 与 content_html,
以降低缓存内存占用与序列化体积。deleted_at 保留,供回收站列表使用。
Fields§
§id: i32文章主键。
作者用户主键。
title: String文章标题。
slug: StringURL slug,用于生成文章链接。
summary: Option<String>摘要,可选。
status: PostStatus文章发布状态。
published_at: Option<DateTime<Utc>>正式发布时间,None 表示尚未发布。
created_at: DateTime<Utc>创建时间。
updated_at: DateTime<Utc>最后更新时间。
deleted_at: Option<DateTime<Utc>>软删除时间,None 表示未删除。仅回收站查询填充。
关联标签列表。
cover_image: Option<String>封面图片 URL。
reading_time: u32预计阅读时间(分钟)。
word_count: u32字数统计。
Implementations§
Source§impl PostListItem
impl PostListItem
Sourcepub fn formatted_date(&self) -> String
pub fn formatted_date(&self) -> String
返回用于展示的文章日期:优先使用发布时间,否则回退到创建时间。
Sourcepub fn status_label(&self) -> &'static str
pub fn status_label(&self) -> &'static str
返回中文状态标签。
Sourcepub fn status_class(&self) -> &'static str
pub fn status_class(&self) -> &'static str
返回状态文本在 light/dark 模式下的 Tailwind 颜色类。
Sourcepub fn status_badge_class(&self) -> &'static str
pub fn status_badge_class(&self) -> &'static str
返回状态徽章在 light/dark 模式下的 Tailwind 背景与颜色类。
Trait Implementations§
Source§impl Clone for PostListItem
impl Clone for PostListItem
Source§fn clone(&self) -> PostListItem
fn clone(&self) -> PostListItem
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PostListItem
impl Debug for PostListItem
Source§impl<'de> Deserialize<'de> for PostListItem
impl<'de> Deserialize<'de> for PostListItem
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for PostListItem
impl PartialEq for PostListItem
Source§impl Serialize for PostListItem
impl Serialize for PostListItem
impl StructuralPartialEq for PostListItem
Auto Trait Implementations§
impl Freeze for PostListItem
impl RefUnwindSafe for PostListItem
impl Send for PostListItem
impl Sync for PostListItem
impl Unpin for PostListItem
impl UnsafeUnpin for PostListItem
impl UnwindSafe for PostListItem
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> InitializeFromFunction<T> for T
impl<T> InitializeFromFunction<T> for T
§fn initialize_from_function(f: fn() -> T) -> T
fn initialize_from_function(f: fn() -> T) -> T
Create an instance of this type from an initialization function
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§impl<T, O> SuperFrom<T> for Owhere
O: From<T>,
impl<T, O> SuperFrom<T> for Owhere
O: From<T>,
§fn super_from(input: T) -> O
fn super_from(input: T) -> O
Convert from a type to another type.
§impl<T, O, M> SuperInto<O, M> for Twhere
O: SuperFrom<T, M>,
impl<T, O, M> SuperInto<O, M> for Twhere
O: SuperFrom<T, M>,
§fn super_into(self) -> O
fn super_into(self) -> O
Convert from a type to another type.
§impl<T> Transportable for Twhere
T: Serialize + DeserializeOwned + 'static,
impl<T> Transportable for Twhere
T: Serialize + DeserializeOwned + 'static,
§fn transport_to_bytes(&self) -> Vec<u8> ⓘ
fn transport_to_bytes(&self) -> Vec<u8> ⓘ
Serialize the type to a byte vector for transport
§fn transport_from_bytes(bytes: &[u8]) -> Result<T, Error<Error>>
fn transport_from_bytes(bytes: &[u8]) -> Result<T, Error<Error>>
Deserialize the type from a byte slice