pub struct StructField {
pub name: String,
pub data_type: DataType,
}Expand description
One named field inside a StructDataType, in the order it was declared.
A struct’s fields are named on every engine that has a record type, and positional on some, so both the name and the position are part of the type.
§Example
use razeri_plugin_contract::{DataType, data_type::StructField};
let zip = StructField::new("zip", DataType::varchar(10));
assert_eq!(zip.name, "zip");
assert_eq!(zip.data_type, DataType::varchar(10));Fields§
§name: StringThe field’s name, as the design declared it.
data_type: DataTypeThe field’s type. May itself be a collection or another struct.
Implementations§
Source§impl StructField
impl StructField
Sourcepub fn new(name: impl Into<String>, data_type: DataType) -> Self
pub fn new(name: impl Into<String>, data_type: DataType) -> Self
Creates a named field of the given type.
§Example
use razeri_plugin_contract::{DataType, data_type::StructField};
let field = StructField::new("category", DataType::varchar(100));
assert_eq!(field.data_type, DataType::varchar(100));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 (const: unstable) · 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
impl Eq for StructField
Source§impl PartialEq for StructField
impl PartialEq 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 UnsafeUnpin 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