pub struct StructField {
pub id: i32,
pub name: String,
pub required: bool,
pub field_type: Type,
pub doc: Option<String>,
}
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: Type
Datatype
doc: Option<String>
Fields may have an optional comment or doc string.
Implementations§
Source§impl StructField
impl StructField
Sourcepub fn new(
id: i32,
name: &str,
required: bool,
field_type: Type,
doc: Option<String>,
) -> Self
pub fn new( id: i32, name: &str, required: bool, field_type: Type, doc: Option<String>, ) -> Self
Creates a new StructField with the given parameters
§Arguments
id
- Unique identifier for this field within the table schemaname
- Name of the fieldrequired
- Whether this field is required (true) or optional (false)field_type
- The data type of this fielddoc
- Optional documentation string for this field
Trait Implementations§
Source§impl Clone for StructField
impl Clone for StructField
Source§fn clone(&self) -> StructField
fn clone(&self) -> StructField
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for StructField
impl Debug for StructField
Source§impl<'de> Deserialize<'de> for StructField
impl<'de> Deserialize<'de> for StructField
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>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for StructField
impl PartialEq for StructField
Source§impl Serialize for StructField
impl Serialize for StructField
impl Eq for StructField
impl StructuralPartialEq for StructField
Auto Trait Implementations§
impl Freeze for StructField
impl RefUnwindSafe for StructField
impl Send for StructField
impl Sync for StructField
impl Unpin for StructField
impl UnwindSafe for StructField
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
Converts
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>
Converts
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