pub struct ProjectState {
pub models: BTreeMap<String, ModelState>,
}Expand description
The whole project’s managed schema.
Fields§
§models: BTreeMap<String, ModelState>Models keyed by ModelState::name.
Implementations§
Source§impl ProjectState
impl ProjectState
Sourcepub fn from_metas(metas: &[&ModelMeta]) -> Self
pub fn from_metas(metas: &[&ModelMeta]) -> Self
Build from compiled metadata, synthesizing auto M2M join tables.
Sourcepub fn model(&self, name: &str) -> Option<&ModelState>
pub fn model(&self, name: &str) -> Option<&ModelState>
Model by name.
Sourcepub fn model_mut(&mut self, name: &str) -> Option<&mut ModelState>
pub fn model_mut(&mut self, name: &str) -> Option<&mut ModelState>
Mutable model by name.
Sourcepub fn model_for_table(&self, table: &str) -> Option<&ModelState>
pub fn model_for_table(&self, table: &str) -> Option<&ModelState>
Model whose table is table.
Sourcepub fn require(&self, name: &str) -> Result<&ModelState, MigrationError>
pub fn require(&self, name: &str) -> Result<&ModelState, MigrationError>
Model named name, or a MigrationError::State.
Sourcepub fn require_mut(
&mut self,
name: &str,
) -> Result<&mut ModelState, MigrationError>
pub fn require_mut( &mut self, name: &str, ) -> Result<&mut ModelState, MigrationError>
Mutable model named name, or a MigrationError::State.
Trait Implementations§
Source§impl Clone for ProjectState
impl Clone for ProjectState
Source§fn clone(&self) -> ProjectState
fn clone(&self) -> ProjectState
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 ProjectState
impl Debug for ProjectState
Source§impl Default for ProjectState
impl Default for ProjectState
Source§fn default() -> ProjectState
fn default() -> ProjectState
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for ProjectState
impl<'de> Deserialize<'de> for ProjectState
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 ProjectState
impl PartialEq for ProjectState
Source§impl Serialize for ProjectState
impl Serialize for ProjectState
impl StructuralPartialEq for ProjectState
Auto Trait Implementations§
impl Freeze for ProjectState
impl RefUnwindSafe for ProjectState
impl Send for ProjectState
impl Sync for ProjectState
impl Unpin for ProjectState
impl UnsafeUnpin for ProjectState
impl UnwindSafe for ProjectState
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