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
impl References
Sourcepub fn check_method(self, method: impl Into<String>) -> Self
pub fn check_method(self, method: impl Into<String>) -> Self
设置摘要方法(字符串形式,保持向后兼容)。
Sourcepub fn set_check_method(self, method: CheckMethod) -> Self
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"));Sourcepub fn check_method_str(&self) -> Option<&str>
pub fn check_method_str(&self) -> Option<&str>
获取摘要方法的字符串值。
Sourcepub fn check_method_enum(&self) -> Option<CheckMethod>
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));Sourcepub fn add_reference(self, reference: Reference) -> Self
pub fn add_reference(self, reference: Reference) -> Self
添加一个文件摘要节点。
Sourcepub fn to_xml_string(&self) -> String
pub fn to_xml_string(&self) -> String
序列化为 XML 字符串。
Trait Implementations§
Source§impl Clone for References
impl Clone for References
Source§fn clone(&self) -> References
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)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for References
impl Debug for References
Auto Trait Implementations§
impl Freeze for References
impl RefUnwindSafe for References
impl Send for References
impl Sync for References
impl Unpin for References
impl UnsafeUnpin for References
impl UnwindSafe for References
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