pub struct ModelState {
pub name: String,
pub table: String,
pub fields: Vec<FieldState>,
pub indexes: Vec<IndexState>,
pub constraints: Vec<ConstraintState>,
}Expand description
Snapshot of one model (or a synthesized M2M join table).
Fields§
§name: StringRust type name (User); also the migration model name.
table: StringTable name.
fields: Vec<FieldState>Concrete columns in declaration order.
indexes: Vec<IndexState>Named indexes.
constraints: Vec<ConstraintState>Table constraints.
Implementations§
Source§impl ModelState
impl ModelState
Sourcepub fn from_meta(meta: &ModelMeta) -> Option<Self>
pub fn from_meta(meta: &ModelMeta) -> Option<Self>
Copy a managed ModelMeta. Returns None when managed is false.
Sourcepub fn field(&self, name: &str) -> Option<&FieldState>
pub fn field(&self, name: &str) -> Option<&FieldState>
Field by Rust name.
Sourcepub fn field_mut(&mut self, name: &str) -> Option<&mut FieldState>
pub fn field_mut(&mut self, name: &str) -> Option<&mut FieldState>
Mutable field by Rust name.
Sourcepub fn column(&self, column: &str) -> Option<&FieldState>
pub fn column(&self, column: &str) -> Option<&FieldState>
Field by column name.
Sourcepub fn pk(&self) -> Option<&FieldState>
pub fn pk(&self) -> Option<&FieldState>
Primary-key field, if declared.
Sourcepub fn index(&self, name: &str) -> Option<&IndexState>
pub fn index(&self, name: &str) -> Option<&IndexState>
Named index.
Sourcepub fn constraint(&self, name: &str) -> Option<&ConstraintState>
pub fn constraint(&self, name: &str) -> Option<&ConstraintState>
Named constraint.
Trait Implementations§
Source§impl Clone for ModelState
impl Clone for ModelState
Source§fn clone(&self) -> ModelState
fn clone(&self) -> ModelState
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 ModelState
impl Debug for ModelState
Source§impl<'de> Deserialize<'de> for ModelState
impl<'de> Deserialize<'de> for ModelState
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 ModelState
impl PartialEq for ModelState
Source§impl Serialize for ModelState
impl Serialize for ModelState
impl StructuralPartialEq for ModelState
Auto Trait Implementations§
impl Freeze for ModelState
impl RefUnwindSafe for ModelState
impl Send for ModelState
impl Sync for ModelState
impl Unpin for ModelState
impl UnsafeUnpin for ModelState
impl UnwindSafe for ModelState
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