pub struct TrustedDocuments { /* private fields */ }Expand description
The allow-list of trusted documents.
Documents are addressable two ways: by the manifest’s operation id
(what a client sends), and by the SHA-256 of their text (so a client that
sends the full document of a trusted operation is accepted too).
Implementations§
Source§impl TrustedDocuments
impl TrustedDocuments
Sourcepub fn with_document(self, document: impl Into<String>) -> Self
pub fn with_document(self, document: impl Into<String>) -> Self
Add a document, addressed by its SHA-256.
Sourcepub fn insert(&mut self, id: impl Into<String>, document: impl Into<String>)
pub fn insert(&mut self, id: impl Into<String>, document: impl Into<String>)
Add a document under an explicit manifest id.
Sourcepub fn from_json(text: &str) -> Result<Self, ManifestError>
pub fn from_json(text: &str) -> Result<Self, ManifestError>
Parse a manifest (Apollo format or a flat {id: document} map).
§Errors
Returns ManifestError::Invalid for malformed JSON, an unknown
Apollo manifest format/version, or a flat entry whose SHA-256 id does
not match its document.
Sourcepub fn from_file(path: &Path) -> Result<Self, ManifestError>
pub fn from_file(path: &Path) -> Result<Self, ManifestError>
Sourcepub fn get(&self, id: &str) -> Option<&Arc<str>>
pub fn get(&self, id: &str) -> Option<&Arc<str>>
The document with manifest id (or SHA-256) id.
Sourcepub fn contains_document(&self, document: &str) -> bool
pub fn contains_document(&self, document: &str) -> bool
Whether a document with this exact text is trusted.
Trait Implementations§
Source§impl Clone for TrustedDocuments
impl Clone for TrustedDocuments
Source§impl Debug for TrustedDocuments
impl Debug for TrustedDocuments
Auto Trait Implementations§
impl Forget for TrustedDocuments
impl Freeze for TrustedDocuments
impl RefUnwindSafe for TrustedDocuments
impl Send for TrustedDocuments
impl Sync for TrustedDocuments
impl Unpin for TrustedDocuments
impl UnsafeUnpin for TrustedDocuments
impl UnwindSafe for TrustedDocuments
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> Scoped for T
impl<T> Scoped for T
Source§fn scope(ctx: &PolicyContext) -> ScopeQuery<'_, Self>
fn scope(ctx: &PolicyContext) -> ScopeQuery<'_, Self>
Open a deferred
ScopeQuery for this type. Resolves the
registered scope at .load() time, not here.