Skip to content

Commit c989793

Browse files
committed
wip
1 parent f0d7d2f commit c989793

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

rust/signed_doc/src/metadata/document_refs/mod.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
33
mod doc_locator;
44
mod doc_ref;
5-
use std::fmt::Display;
5+
use std::{fmt::Display, ops::Deref};
66

77
use catalyst_types::uuid::{CborContext, UuidV7};
88
use cbork_utils::{array::Array, decode_context::DecodeCtx};
@@ -17,6 +17,14 @@ use crate::CompatibilityPolicy;
1717
#[derive(Clone, Debug, PartialEq, Hash, Eq)]
1818
pub struct DocumentRefs(Vec<DocumentRef>);
1919

20+
impl Deref for DocumentRefs {
21+
type Target = Vec<DocumentRef>;
22+
23+
fn deref(&self) -> &Self::Target {
24+
&self.0
25+
}
26+
}
27+
2028
impl DocumentRefs {
2129
/// Returns true if provided `cbor` bytes is a valid old format.
2230
/// ```cddl
@@ -50,14 +58,6 @@ pub enum DocRefError {
5058
HexDecode(String),
5159
}
5260

53-
impl DocumentRefs {
54-
/// Get a list of document reference instance.
55-
#[must_use]
56-
pub fn doc_refs(&self) -> &Vec<DocumentRef> {
57-
&self.0
58-
}
59-
}
60-
6161
impl From<Vec<DocumentRef>> for DocumentRefs {
6262
fn from(value: Vec<DocumentRef>) -> Self {
6363
DocumentRefs(value)

rust/signed_doc/src/validator/rules/doc_ref.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ where
8484
{
8585
let mut all_valid = true;
8686

87-
for dr in doc_refs.doc_refs() {
87+
for dr in doc_refs.iter() {
8888
if let Some(ref ref_doc) = provider.try_get_doc(dr).await? {
8989
let is_valid = referenced_doc_type_check(ref_doc, exp_ref_types, field_name, report)
9090
&& referenced_doc_id_and_ver_check(ref_doc, dr, field_name, report)

rust/signed_doc/src/validator/rules/parameters.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ where
129129

130130
let mut all_valid = true;
131131

132-
for dr in ref_field.doc_refs() {
132+
for dr in ref_field.iter() {
133133
if let Some(ref ref_doc) = provider.try_get_doc(dr).await? {
134134
let Some(ref_doc_parameters) = ref_doc.doc_meta().parameters() else {
135135
report.missing_field(

0 commit comments

Comments
 (0)