Struct grafbase_local_common::environment::Environment
source · [−]pub struct Environment {
pub project_path: PathBuf,
pub project_dot_grafbase_path: PathBuf,
pub project_grafbase_path: PathBuf,
pub project_grafbase_schema_path: PathBuf,
pub user_dot_grafbase_path: PathBuf,
pub project_grafbase_registry_path: PathBuf,
}
Expand description
a static representation of the current environment
must be initialized before use
Fields
project_path: PathBuf
the path of the (assumed) user project root ($PROJECT
), the nearest ancestor directory
with a grafbase/schema.graphql
file
project_dot_grafbase_path: PathBuf
the path of $PROJECT/.grafbase/
, the Grafbase local developer tool cache and database folder,
in the nearest ancestor directory with grafbase/schema.graphql
project_grafbase_path: PathBuf
the path of $PROJECT/grafbase/
, the Grafbase schema folder in the nearest ancestor directory
with grafbase/schema.graphql
project_grafbase_schema_path: PathBuf
the path of $PROJECT/grafbase/schema.graphql
, the Grafbase schema,
in the nearest ancestor directory with said folder and file
user_dot_grafbase_path: PathBuf
the path of $HOME/.grafbase
, the user level local developer tool cache folder
project_grafbase_registry_path: PathBuf
the path of $PROJECT/.grafbase/registry.json
, the registry derived from schema.graphql
,
in the nearest ancestor directory with a grabase/schema.graphql
file
Implementations
sourceimpl Environment
impl Environment
sourcepub fn try_init() -> Result<(), CommonError>
pub fn try_init() -> Result<(), CommonError>
initializes the static Environment instance
Errors
returns CommonError::ReadCurrentDirectory
if the current directory path cannot be read
returns CommonError::FindGrafbaseDirectory
if the grafbase directory is not found
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Environment
impl Send for Environment
impl Sync for Environment
impl Unpin for Environment
impl UnwindSafe for Environment
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more