pub async fn read_project(&mut self,
        override_dir: Option<&Path>, search_parents: bool)
        -> Result<&mut Self, Error>
    {
        let dir = match override_dir {
            Some(v) => Cow::Borrowed(v.as_ref()),
            None => {
                Cow::Owned(env::current_dir()
                    .map_err(|e| ClientError::with_source(e)
                        .context("failed to get current directory"))?
                    .into())
            }
        };

        let dir = if search_parents {
            if let Some(ancestor) = search_dir(&dir).await? {
                Cow::Borrowed(ancestor)
            } else {
                return Ok(self);
            }
        } else {
            if !dir.join("edgedb.toml").exists().await {
                return Ok(self);
            }
            dir
        };
        let canon = fs::canonicalize(&dir).await
            .map_err(|e| ClientError::with_source(e).context(
                format!("failed to canonicalize dir {:?}", dir)
            ))?;
        let stash_path = stash_path(canon.as_ref())?;
        if AsRef::<AsyncPath>::as_ref(&stash_path).exists().await {
            let instance =
                fs::read_to_string(stash_path.join("instance-name")).await
                .map_err(|e| ClientError::with_source(e).context(
                    format!("error reading project settings {:?}", dir)
                ))?;
            self.read_instance(instance.trim()).await?;

        }
        Ok(self)
    }
/// Reads the project config if it exists.
///
/// Projects are initialized using the command-line tool:
/// ```shell
/// edgedb project init
/// ```
/// Linking to an already running EdgeDB is also possible:
/// ```shell
/// edgedb project init --link
/// ```
///
/// Returns a boolean value indicating whether the project was found.
Reads the project config if it exists.

Returns a boolean value indicating whether the project was found.
Reads the project config if it exists . Returns a boolean value indicating whether the project was found .
pub async fn read_project(&mut self,
        override_dir: Option<&Path>, search_parents: bool)
        -> Result<&mut Self, Error>
    {
        let dir = match override_dir {
            Some(v) => Cow::Borrowed(v.as_ref()),
            None => {
                Cow::Owned(env::current_dir()
                    .map_err(|e| ClientError::with_source(e)
                        .context("failed to get current directory"))?
                    .into())
            }
        };
        let dir = if search_parents {
            if let Some(ancestor) = search_dir(&dir).await? {
                Cow::Borrowed(ancestor)
            } else {
                return Ok(self);
            }
        } else {
            if !dir.join("edgedb.toml").exists().await {
                return Ok(self);
            }
            dir
        };
        let canon = fs::canonicalize(&dir).await
            .map_err(|e| ClientError::with_source(e).context(
                format!("failed to canonicalize dir {:?}", dir)
            ))?;
        let stash_path = stash_path(canon.as_ref())?;
        if AsRef::<AsyncPath>::as_ref(&stash_path).exists().await {
            let instance =
                fs::read_to_string(stash_path.join("instance-name")).await
                .map_err(|e| ClientError::with_source(e).context(
                    format!("error reading project settings {:?}", dir)
                ))?;
            self.read_instance(instance.trim()).await?;
        }
        Ok(self)
    }
pub async fn read_project ( & mut self , override_dir : Option < & Path > , search_parents : bool ) -> Result < & mut Self , Error > { let dir = match override_dir { Some ( v ) => Cow :: Borrowed ( v . as_ref ( ) ) , None => { Cow :: Owned ( env :: current_dir ( ) . map_err ( | e | ClientError :: with_source ( e ) . context ( " " ) ) ? . into ( ) ) } } ; let dir = if search_parents { if let Some ( ancestor ) = search_dir ( & dir ) . await ? { Cow :: Borrowed ( ancestor ) } else { return Ok ( self ) ; } } else { if ! dir . join ( " " ) . exists ( ) . await { return Ok ( self ) ; } dir } ; let canon = fs :: canonicalize ( & dir ) . await . map_err ( | e | ClientError :: with_source ( e ) . context ( format ! ( " " dir ) ) ) ? ; let stash_path = stash_path ( canon . as_ref ( ) ) ? ; if AsRef :: < AsyncPath > :: as_ref ( & stash_path ) . exists ( ) . await { let instance = fs :: read_to_string ( stash_path . join ( " " ) ) . await . map_err ( | e | ClientError :: with_source ( e ) . context ( format ! ( " " dir ) ) ) ? ; self . read_instance ( instance . trim ( ) ) . await ? ; } Ok ( self ) }
Reads the project config if it exists.
Reads the project config if it exists .
&mut self
override_dir
Option<&Path>
search_parents
bool