pub struct NestedField {
pub id: i32,
pub name: String,
pub required: bool,
pub field_type: Box<Type>,
pub doc: Option<String>,
pub initial_default: Option<Literal>,
pub write_default: Option<Literal>,
}
Expand description
A struct is a tuple of typed values. Each field in the tuple is named and has an integer id that is unique in the table schema. Each field can be either optional or required, meaning that values can (or cannot) be null. Fields may be any type. Fields may have an optional comment or doc string. Fields can have default values.
Fields§
§id: i32
Id unique in table schema
name: String
Field Name
required: bool
Optional or required
field_type: Box<Type>
Datatype
doc: Option<String>
Fields may have an optional comment or doc string.
initial_default: Option<Literal>
Used to populate the field’s value for all records that were written before the field was added to the schema
write_default: Option<Literal>
Used to populate the field’s value for any records written after the field was added to the schema, if the writer does not supply the field’s value
Implementations§
Source§impl NestedField
impl NestedField
Sourcepub fn new(
id: i32,
name: impl ToString,
field_type: Type,
required: bool,
) -> Self
pub fn new( id: i32, name: impl ToString, field_type: Type, required: bool, ) -> Self
Construct a new field.
Sourcepub fn required(id: i32, name: impl ToString, field_type: Type) -> Self
pub fn required(id: i32, name: impl ToString, field_type: Type) -> Self
Construct a required field.
Sourcepub fn optional(id: i32, name: impl ToString, field_type: Type) -> Self
pub fn optional(id: i32, name: impl ToString, field_type: Type) -> Self
Construct an optional field.
Sourcepub fn list_element(id: i32, field_type: Type, required: bool) -> Self
pub fn list_element(id: i32, field_type: Type, required: bool) -> Self
Construct list type’s element field.
Sourcepub fn map_key_element(id: i32, field_type: Type) -> Self
pub fn map_key_element(id: i32, field_type: Type) -> Self
Construct map type’s key field.
Sourcepub fn map_value_element(id: i32, field_type: Type, required: bool) -> Self
pub fn map_value_element(id: i32, field_type: Type, required: bool) -> Self
Construct map type’s value field.
Sourcepub fn with_initial_default(self, value: Literal) -> Self
pub fn with_initial_default(self, value: Literal) -> Self
Set the field’s initial default value.
Sourcepub fn with_write_default(self, value: Literal) -> Self
pub fn with_write_default(self, value: Literal) -> Self
Set the field’s initial default value.
Trait Implementations§
Source§impl Clone for NestedField
impl Clone for NestedField
Source§fn clone(&self) -> NestedField
fn clone(&self) -> NestedField
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for NestedField
impl Debug for NestedField
Source§impl<'de> Deserialize<'de> for NestedField
impl<'de> Deserialize<'de> for NestedField
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Display for NestedField
impl Display for NestedField
Source§impl PartialEq for NestedField
impl PartialEq for NestedField
Source§impl Serialize for NestedField
impl Serialize for NestedField
impl Eq for NestedField
impl StructuralPartialEq for NestedField
Auto Trait Implementations§
impl Freeze for NestedField
impl RefUnwindSafe for NestedField
impl Send for NestedField
impl Sync for NestedField
impl Unpin for NestedField
impl UnwindSafe for NestedField
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more