Skip to main content

References

Struct References 

Source
pub struct References {
    pub check_method: Option<String>,
    pub references: Vec<Reference>,
}
Expand description

签名的范围。

包含受本次签名保护的文件摘要记录列表。 一个受保护的包内文件对应一个 Reference 节点。

Fields§

§check_method: Option<String>

摘要方法(可选)。 视应用场景的不同使用不同的摘要方法。

§references: Vec<Reference>

针对各文件的摘要节点列表。

Implementations§

Source§

impl References

Source

pub fn new() -> Self

创建空的签名范围。

Source

pub fn check_method(self, method: impl Into<String>) -> Self

设置摘要方法(字符串形式,保持向后兼容)。

Source

pub fn set_check_method(self, method: CheckMethod) -> Self

设置摘要方法(类型安全的枚举形式)。

使用 CheckMethod 枚举避免拼写错误,产出的字符串与 Java 完全一致。

§示例
use easyofd_core::signatures::{CheckMethod, References};

let refs = References::new().set_check_method(CheckMethod::Sm3);
assert_eq!(refs.check_method_str(), Some("SM3"));
Source

pub fn check_method_str(&self) -> Option<&str>

获取摘要方法的字符串值。

Source

pub fn check_method_enum(&self) -> Option<CheckMethod>

获取摘要方法枚举值(若已设置且可解析)。

§示例
use easyofd_core::signatures::{CheckMethod, References};

let refs = References::new().check_method("SM3");
assert_eq!(refs.check_method_enum(), Some(CheckMethod::Sm3));
Source

pub fn add_reference(self, reference: Reference) -> Self

添加一个文件摘要节点。

Source

pub fn has_file(&self, abs_loc: &str) -> bool

检查是否包含指定路径的文件。

Source

pub fn to_xml_string(&self) -> String

序列化为 XML 字符串。

Trait Implementations§

Source§

impl Clone for References

Source§

fn clone(&self) -> References

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 References

Source§

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

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

impl Default for References

Source§

fn default() -> Self

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

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<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> 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, !>

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.