diff --git a/crates/cli/src/subcommands/generate/rust.rs b/crates/cli/src/subcommands/generate/rust.rs index 4216fbc3b59..bd5bcff3e7c 100644 --- a/crates/cli/src/subcommands/generate/rust.rs +++ b/crates/cli/src/subcommands/generate/rust.rs @@ -1001,7 +1001,7 @@ fn print_handle_event_defn(out: &mut Indenter, items: &[GenItem]) { } const CONNECT_DOCSTRING: &[&str] = &[ - "/// Connect to a database named `db_name` accessible over the internet at the URI `host`.", + "/// Connect to a database named `db_name` accessible over the internet at the URI `spacetimedb_uri`.", "///", "/// If `credentials` are supplied, they will be passed to the new connection to", "/// identify and authenticate the user. Otherwise, a set of `Credentials` will be", @@ -1017,17 +1017,17 @@ fn print_connect_docstring(out: &mut Indenter) { fn print_connect_defn(out: &mut Indenter) { print_connect_docstring(out); out.delimited_block( - "pub fn connect(host: Host, db_name: &str, credentials: Option) -> Result<()> + "pub fn connect(spacetimedb_uri: IntoUri, db_name: &str, credentials: Option) -> Result<()> where -\tHost: TryInto, -\t>::Error: std::error::Error + Send + Sync + 'static, +\tIntoUri: TryInto, +\t>::Error: std::error::Error + Send + Sync + 'static, {", |out| out.delimited_block( "with_connection_mut(|connection| {", |out| { writeln!( out, - "connection.connect(host, db_name, credentials, handle_table_update, handle_resubscribe, invoke_row_callbacks, handle_event)?;" + "connection.connect(spacetimedb_uri, db_name, credentials, handle_table_update, handle_resubscribe, invoke_row_callbacks, handle_event)?;" ).unwrap(); writeln!(out, "Ok(())").unwrap(); }, diff --git a/crates/sdk/src/background_connection.rs b/crates/sdk/src/background_connection.rs index 4456a3ca21d..37cf1348d61 100644 --- a/crates/sdk/src/background_connection.rs +++ b/crates/sdk/src/background_connection.rs @@ -275,7 +275,7 @@ impl BackgroundDbConnection { )) } - /// Connect to a database named `db_name` accessible over the internet at the URI `host`. + /// Connect to a database named `db_name` accessible over the internet at the URI `spacetimedb_uri`. /// /// If `credentials` are supplied, they will be passed to the new connection to /// identify and authenticate the user. Otherwise, a set of `Credentials` will be @@ -293,9 +293,9 @@ impl BackgroundDbConnection { // calls are autogenerated by the CLI, // with a wrapper that takes only 3 arguments. #[allow(clippy::too_many_arguments)] - pub fn connect( + pub fn connect( &mut self, - host: Host, + spacetimedb_uri: IntoUri, db_name: &str, credentials: Option, handle_table_update: crate::client_cache::HandleTableUpdateFn, @@ -304,14 +304,14 @@ impl BackgroundDbConnection { handle_event: crate::callbacks::HandleEventFn, ) -> Result<()> where - Host: TryInto, - >::Error: std::error::Error + Send + Sync + 'static, + IntoUri: TryInto, + >::Error: std::error::Error + Send + Sync + 'static, { // `block_in_place` is required here, as tokio won't allow us to call // `block_on` if it would block the current thread of an outer runtime let connection = tokio::task::block_in_place(|| { self.handle - .block_on(DbConnection::connect(host, db_name, credentials.as_ref())) + .block_on(DbConnection::connect(spacetimedb_uri, db_name, credentials.as_ref())) })?; let client_cache = Arc::new(Mutex::new(Arc::new(ClientCache::new( handle_table_update,