pub struct ProjectView {
pub root: PathBuf,
pub models_files: BTreeMap<String, ParsedModelsFile>,
pub existing_migrations: Vec<String>,
pub migration_sources: BTreeMap<String, String>,
}Expand description
Parsed view of the project files the executor cares about.
Fields§
§root: PathBuf§models_files: BTreeMap<String, ParsedModelsFile>Parsed apps/<app>/models.rs files, keyed by app directory name.
existing_migrations: Vec<String>Filenames (not full paths) of files in migrations/.
migration_sources: BTreeMap<String, String>Contents of every migration file, keyed by filename. Populated by
ProjectView::from_dir; tests constructing a ProjectView
directly may leave it empty, in which case FK detection returns
false (no constraint known) — the caller is responsible for
seeding this map when simulating a project that has FKs.
Implementations§
Source§impl ProjectView
impl ProjectView
Sourcepub fn from_dir(root: &Path) -> Result<Self, ExecutionError>
pub fn from_dir(root: &Path) -> Result<Self, ExecutionError>
Build a ProjectView by reading the project at root. Reads
every apps/*/models.rs and lists migrations/*. Returns a
ExecutionError::ProjectStructure if the scaffold isn’t
recognisable — the executor will not apply to a non-rustio
directory.
Trait Implementations§
Source§impl Clone for ProjectView
impl Clone for ProjectView
Source§fn clone(&self) -> ProjectView
fn clone(&self) -> ProjectView
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 ProjectView
impl Debug for ProjectView
Source§impl PartialEq for ProjectView
impl PartialEq for ProjectView
Source§fn eq(&self, other: &ProjectView) -> bool
fn eq(&self, other: &ProjectView) -> bool
Tests for
self and other values to be equal, and is used by ==.impl Eq for ProjectView
impl StructuralPartialEq for ProjectView
Auto Trait Implementations§
impl Freeze for ProjectView
impl RefUnwindSafe for ProjectView
impl Send for ProjectView
impl Sync for ProjectView
impl Unpin for ProjectView
impl UnsafeUnpin for ProjectView
impl UnwindSafe for ProjectView
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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