Skip to main content

ContextSource

Trait ContextSource 

Source
pub trait ContextSource: Send + Sync {
    // Required method
    fn with_tree(&self, visitor: &mut dyn FnMut(JsonSubtree<'_>));

    // Provided methods
    fn release(self: Arc<Self>) { ... }
    fn secret_paths(&self) -> &[String] { ... }
    fn with_tree_and_secrets(
        &self,
        visitor: &mut dyn FnMut(JsonSubtree<'_>, &[String]),
    ) { ... }
    fn with_secrets(&self, visitor: &mut dyn FnMut(&[String])) { ... }
}
Expand description

Shared immutable provider. The callback runs synchronously under the provider’s read guard; no tree borrow or mutable owner can escape it.

Required Methods§

Source

fn with_tree(&self, visitor: &mut dyn FnMut(JsonSubtree<'_>))

Provided Methods§

Source

fn release(self: Arc<Self>)

Providers with prepaid shared storage release the physical Arc before destroying its allocation bill. Every erased handle calls this hook.

Source

fn secret_paths(&self) -> &[String]

Absolute schema paths explicitly marked secret by the source owner.

Source

fn with_tree_and_secrets( &self, visitor: &mut dyn FnMut(JsonSubtree<'_>, &[String]), )

Borrow a tree and its policy under the same provider read guard. Switching Live/Frozen sources override this callback; borrows cannot escape the callback or outlive the source’s synchronized state.

Source

fn with_secrets(&self, visitor: &mut dyn FnMut(&[String]))

Trait Implementations§

Source§

impl AsRef<dyn ContextSource> for ContextSourceRef

Source§

fn as_ref(&self) -> &(dyn ContextSource + 'static)

Converts this type into a shared reference of the (usually inferred) input type.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§