You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: lib.rs
    path of file: ./repos/shuttle/resources/turso/src
    
    the code of the file until where you have to start completion: use async_trait::async_trait;
use libsql::{Connection, Database};
use serde::{Deserialize, Serialize};
use shuttle_service::{
    error::{CustomError, Error as ShuttleError},
    Environment, Into
    
    async fn build(self, factory: &ResourceFactory) -> Result<Self::Input, ShuttleError> {
        let md = factory.get_metadata();
        match md.env {
            Environment::Deployment => {
                if self.addr.is_empty() {
                    Err(ShuttleError::Custom(CustomError::msg("missing addr")))
                } else {
                    if !self.addr.starts_with("libsql://") && !self.addr.starts_with("https://") {
                        return Err(ShuttleError::Custom(CustomError::msg(
                            "addr must start with either libsql:// or https://",
                        )));
                    }
                    self.output_from_addr(&self.addr, md.env).await
                }
            }
            Environment::Local => {
                match self.local_addr {
                    Some(ref local_addr) => self.output_from_addr(local_addr, md.env).await,
                    None => {
                        // Default to a local db of the name of the service.
                        let db_file = std::env::current_dir() // Should be root of the project's workspace
                            .and_then(dunce::canonicalize)
                            .map(|cd| {
                                let mut p = cd.join(md.project_name);
                                p.set_extension("db");
                                p
                            })
                            .map_err(Error::LocateLocalDB)?;
                        let conn_url = format!("file:{}", db_file.display());
                        Ok(TursoOutput {
                            conn_url: Url::parse(&conn_url).map_err(Error::UrlParseError)?,
                            // Nullify the token since we're using a file as database.
                            token: None,
                            environment: md.env,
                        })
                    }
                }
            }
        }
    }