Skip to main content

Res

Struct Res 

Source
pub struct Res {
    pub base_loc: StLoc,
    pub children: Vec<ResChild>,
}
Expand description

Res:资源文件根节点(见表 18)。

规范中 Res 的内容为一个可重复、无序的选择(xs:choice maxOccurs="unbounded"), 即各资源组(如 MultiMedias)允许出现多次且可与其他组交错。故这里以保留文档 顺序的子节点序列 children 建模,并提供 Res::fonts 等便捷 方法跨组扁平化遍历其中的资源项。

Fields§

§base_loc: StLoc

定义此资源文件的通用数据存储路径(必选)。

资源文件中各数据文件的默认存储位置以此为基准。

§children: Vec<ResChild>

资源组子节点,按在文档中出现的顺序保留(可重复、可交错)。

Implementations§

Source§

impl Res

Source

pub fn color_spaces(&self) -> impl Iterator<Item = &CtColorSpace>

跨所有 ColorSpaces 组遍历颜色空间资源。

Source

pub fn draw_params(&self) -> impl Iterator<Item = &CtDrawParam>

跨所有 DrawParams 组遍历绘制参数资源。

Source

pub fn fonts(&self) -> impl Iterator<Item = &CtFont>

跨所有 Fonts 组遍历字型资源。

Source

pub fn multi_medias(&self) -> impl Iterator<Item = &CtMultiMedia>

跨所有 MultiMedias 组遍历多媒体资源。

Source

pub fn composite_graphic_units(&self) -> impl Iterator<Item = &CtVectorG>

跨所有 CompositeGraphicUnits 组遍历矢量图像资源。

Trait Implementations§

Source§

impl Clone for Res

Source§

fn clone(&self) -> Res

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 Res

Source§

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

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

impl Default for Res

Source§

fn default() -> Res

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for Res

Source§

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 Serialize for Res

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl Freeze for Res

§

impl RefUnwindSafe for Res

§

impl Send for Res

§

impl Sync for Res

§

impl Unpin for Res

§

impl UnsafeUnpin for Res

§

impl UnwindSafe for Res

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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 = Infallible

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.