pub struct MetadataSchemaBuilder { /* private fields */ }Expand description
Builder for MetadataSchema.
Its fmt::Debug output uses strict redaction with one cumulative
diagnostic budget for the field map and builder state. If that budget is
exceeded, Debug displays <redaction incomplete>. A stored build error is
represented only by whether an error exists; Self::build returns its
original details. Debug output is bounded, but field names are not treated
as a confidentiality boundary.
§Examples
use qubit_datatype::DataType;
use qubit_metadata::MetadataSchema;
let schema = MetadataSchema::builder()
.required("tenant", DataType::String)
.build()?;
assert!(schema.field("tenant").is_some());Implementations§
Source§impl MetadataSchemaBuilder
impl MetadataSchemaBuilder
Sourcepub fn replace_field(self, key: &str, field: MetadataField) -> Self
pub fn replace_field(self, key: &str, field: MetadataField) -> Self
Sourcepub fn unknown_metadata_field_policy(
self,
policy: UnknownMetadataFieldPolicy,
) -> Self
pub fn unknown_metadata_field_policy( self, policy: UnknownMetadataFieldPolicy, ) -> Self
Sourcepub fn unknown_filter_field_policy(
self,
policy: UnknownFilterFieldPolicy,
) -> Self
pub fn unknown_filter_field_policy( self, policy: UnknownFilterFieldPolicy, ) -> Self
Sourcepub fn build(self) -> MetadataResult<MetadataSchema>
pub fn build(self) -> MetadataResult<MetadataSchema>
Builds the schema.
§Returns
The immutable schema described by this builder.
§Errors
Returns MetadataError::DuplicateSchemaField when required or
optional declare the same key more than once.
Trait Implementations§
Source§impl Clone for MetadataSchemaBuilder
impl Clone for MetadataSchemaBuilder
Source§impl Debug for MetadataSchemaBuilder
impl Debug for MetadataSchemaBuilder
Source§impl Default for MetadataSchemaBuilder
impl Default for MetadataSchemaBuilder
impl Eq for MetadataSchemaBuilder
Source§impl PartialEq for MetadataSchemaBuilder
impl PartialEq for MetadataSchemaBuilder
Source§impl Redact for MetadataSchemaBuilder
impl Redact for MetadataSchemaBuilder
Source§fn write_redacted(&self, writer: &mut RedactionWriter<'_>)
fn write_redacted(&self, writer: &mut RedactionWriter<'_>)
Writes builder fields through one cumulative diagnostic budget.
§Parameters
writer- Redaction writer receiving the builder representation.
impl StructuralPartialEq for MetadataSchemaBuilder
Auto Trait Implementations§
impl Forget for MetadataSchemaBuilder
impl Freeze for MetadataSchemaBuilder
impl Move for MetadataSchemaBuilder
impl RefUnwindSafe for MetadataSchemaBuilder
impl Send for MetadataSchemaBuilder
impl Sync for MetadataSchemaBuilder
impl Unpin for MetadataSchemaBuilder
impl UnsafeUnpin for MetadataSchemaBuilder
impl UnwindSafe for MetadataSchemaBuilder
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