pub struct Part {
pub partname: PartName,
pub content_type: String,
pub blob: Vec<u8>,
}Expand description
一个 OPC part。
Part 包含:
- 名称
PartName(绝对路径); - 内容类型
content_type(如application/vnd.openxmlformats-officedocument.presentationml.slide+xml); blob(字节内容,未解析)。
Fields§
§partname: PartNamePart 名称(绝对路径)。
content_type: StringContent-Type 字符串。
blob: Vec<u8>原始字节内容。
Implementations§
Source§impl Part
impl Part
Sourcepub fn blob_text(&self) -> Option<Cow<'_, str>>
pub fn blob_text(&self) -> Option<Cow<'_, str>>
blob 转字符串(UTF-8)。
若不是合法 UTF-8 返回 None,调用方应自行决定是否报错。
Sourcepub fn contribute_to(&self, ct: &mut ContentTypes)
pub fn contribute_to(&self, ct: &mut ContentTypes)
通知 ContentTypes 自己存在:根据扩展名或 override 添加相应记录。
.rels由 default ContentType 处理(application/vnd...relationships+xml).xml与其它扩展都显式注册 override,PowerPoint 严格要求每个 XML part 都有显式 Content-Type。
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Part
impl RefUnwindSafe for Part
impl Send for Part
impl Sync for Part
impl Unpin for Part
impl UnsafeUnpin for Part
impl UnwindSafe for Part
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