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

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

returns a reference to the static Environment instance

Panics

panics if the Environment object was not previously initialized using Environment::try_init()

Trait Implementations

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.