// TODO: refactor usages of this to use the Server rather than this trait and to
//       explicitly create a database.
refactor usages of this to use the Server rather than this trait and to
explicitly create a database.
refactor usages of this to use the Server rather than this trait and to explicitly create a database .
async fn db_or_create(&self, name: &str) -> Result<Arc<Self::Database>, Self::Error> {
        let db_name = DatabaseName::new(name.to_string()).context(InvalidDatabaseName)?;
        let db = match self.db(&db_name) {
            Some(db) => db,
            None => {
                self.create_database(DatabaseRules::new(db_name.clone()))
                    .await?;
                self.db(&db_name).expect("db not inserted")
            }
        };
        Ok(db)
    }
async fn db_or_create ( & self , name : & str ) -> Result < Arc < Self :: Database > , Self :: Error > { let db_name = DatabaseName :: new ( name . to_string ( ) ) . context ( InvalidDatabaseName ) ? ; let db = match self . db ( & db_name ) { Some ( db ) => db , None => { self . create_database ( DatabaseRules :: new ( db_name . clone ( ) ) ) . await ? ; self . db ( & db_name ) . expect ( " " ) } } ; Ok ( db ) }
TODO: refactor usages of this to use the Server rather than this trait and to
explicitly create a database.
TODO : refactor usages of this to use the Server rather than this trait and to explicitly create a database .
&self
name
&str