pub struct CompiledContract {
pub version: String,
pub on_breach: OnBreach,
pub allow_extra_fields: bool,
pub fields: Vec<CompiledField>,
pub declared: HashSet<String>,
}Available on crate feature
contract only.Expand description
A fully compiled contract. Built once via CompiledContract::compile.
Fields§
§version: StringContract version (carried into breach errors and DLQ envelopes).
on_breach: OnBreachBreach policy.
allow_extra_fields: boolWhen false, undeclared top-level keys breach the contract.
fields: Vec<CompiledField>Compiled per-field rules, in declared order (first breach wins).
declared: HashSet<String>Declared field names, for the O(1) extra-field membership test.
Implementations§
Source§impl CompiledContract
impl CompiledContract
Sourcepub fn compile(spec: &ContractSpec) -> Result<Self, FaucetError>
pub fn compile(spec: &ContractSpec) -> Result<Self, FaucetError>
Compile and validate a ContractSpec. Returns FaucetError::Config
on a malformed contract: empty version, no fields, duplicate/empty
field names, an invalid regex, an empty or type-mismatched enum,
constraints that don’t apply to the declared type, or min > max.
Sourcepub fn requires_dlq(&self) -> bool
pub fn requires_dlq(&self) -> bool
True when breaches route records to the DLQ (so a DLQ sink is required). Checked by the pipeline at run start and by the CLI at config-load time.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for CompiledContract
impl RefUnwindSafe for CompiledContract
impl Send for CompiledContract
impl Sync for CompiledContract
impl Unpin for CompiledContract
impl UnsafeUnpin for CompiledContract
impl UnwindSafe for CompiledContract
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
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request