pub async fn read_credentials(&mut self, path: impl AsRef<Path>)
        -> Result<&mut Self, Error>
    {
        let path = path.as_ref();
        async {
            let data = fs::read(path).await
                .map_err(ClientError::with_source)?;
            let creds = serde_json::from_slice(&data)
                .map_err(ClientError::with_source)?;
            self.credentials(&creds)?;
            Ok(())
        }.await.map_err(|e: Error| e.context(
            format!("cannot read credentials file {}", path.display())
        ))?;
        Ok(self)
    }
/// Read credentials from a file.
///
/// This will mark the builder as initialized (if reading is successful)
/// and overwrite all credentials. However, `insecure_dev_mode`, pools
/// sizes, and timeouts are kept intact.
Read credentials from a file.
This will mark the builder as initialized (if reading is successful)
and overwrite all credentials. However, `insecure_dev_mode`, pools
sizes, and timeouts are kept intact.
Read credentials from a file . This will mark the builder as initialized ( if reading is successful ) and overwrite all credentials . However ` insecure_dev_mode ` pools sizes and timeouts are kept intact .
pub async fn read_credentials(&mut self, path: impl AsRef<Path>)
        -> Result<&mut Self, Error>
    {
        let path = path.as_ref();
        async {
            let data = fs::read(path).await
                .map_err(ClientError::with_source)?;
            let creds = serde_json::from_slice(&data)
                .map_err(ClientError::with_source)?;
            self.credentials(&creds)?;
            Ok(())
        }.await.map_err(|e: Error| e.context(
            format!("cannot read credentials file {}", path.display())
        ))?;
        Ok(self)
    }
pub async fn read_credentials ( & mut self , path : impl AsRef < Path > ) -> Result < & mut Self , Error > { let path = path . as_ref ( ) ; async { let data = fs :: read ( path ) . await . map_err ( ClientError :: with_source ) ? ; let creds = serde_json :: from_slice ( & data ) . map_err ( ClientError :: with_source ) ? ; self . credentials ( & creds ) ? ; Ok ( ( ) ) } . await . map_err ( | e : Error | e . context ( format ! ( " " path display ( ) ) ) ) ? ; Ok ( self ) }
Read credentials from a file.
Read credentials from a file .
&mut self
path
impl AsRef<Path>