pub struct AutoField {
pub name: &'static str,
pub label: &'static str,
pub field_type: Option<FieldType>,
pub required: bool,
pub is_foreign_key: bool,
pub options: Vec<(String, String)>,
}Expand description
Declarative description of one field on a model. The caller fills
this in once per column; the converter turns it into a
FieldConfig.
field_type = None asks the engine to infer the type from the
field’s name (via infer_field_type). is_foreign_key = true
always wins — even if field_type or inference says otherwise,
the final widget is a <select> populated from options.
Fields§
§name: &'static str§label: &'static str§field_type: Option<FieldType>If None, infer_field_type runs against name.
required: bool§is_foreign_key: boolForces FieldType::ForeignKey, overriding both field_type
and inference. The FK is always rendered as a <select> with
options supplying human-readable labels.
options: Vec<(String, String)>(value, label) pairs consumed by Select / ForeignKey.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for AutoField
impl RefUnwindSafe for AutoField
impl Send for AutoField
impl Sync for AutoField
impl Unpin for AutoField
impl UnsafeUnpin for AutoField
impl UnwindSafe for AutoField
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> 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> 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