pub struct ContentTypes {
pub defaults: Vec<DefaultExt>,
pub overrides: Vec<Override>,
/* private fields */
}Expand description
[Content_Types].xml 模型。
内部用 BTreeMap 索引 by_partname 提供 O(log n) 的“是否已 override“查询;
Vec<Override> 用于序列化时保留插入顺序。
Fields§
§defaults: Vec<DefaultExt>默认项(按扩展名)。
overrides: Vec<Override>覆盖项(按 partname)。
Implementations§
Source§impl ContentTypes
impl ContentTypes
Sourcepub fn new_default() -> ContentTypes
pub fn new_default() -> ContentTypes
构造一个带默认项的 ContentTypes(xml/rels/png/jpeg/jpg/gif/bmp/svg)。
默认项与 PowerPoint 标准输出对齐,可直接被 Office 解析。
Sourcepub fn add_override(&mut self, partname: &str, content_type: &str)
pub fn add_override(&mut self, partname: &str, content_type: &str)
添加或覆盖一个 partname。
已存在则不覆盖——首个插入的 Content-Type 生效(与 python-pptx 行为一致)。
Sourcepub fn has_override(&self, partname: &str) -> bool
pub fn has_override(&self, partname: &str) -> bool
是否已 override。
Trait Implementations§
Source§impl Clone for ContentTypes
impl Clone for ContentTypes
Source§fn clone(&self) -> ContentTypes
fn clone(&self) -> ContentTypes
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 ContentTypes
impl Debug for ContentTypes
Source§impl Default for ContentTypes
impl Default for ContentTypes
Source§fn default() -> ContentTypes
fn default() -> ContentTypes
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ContentTypes
impl RefUnwindSafe for ContentTypes
impl Send for ContentTypes
impl Sync for ContentTypes
impl Unpin for ContentTypes
impl UnsafeUnpin for ContentTypes
impl UnwindSafe for ContentTypes
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