diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4ce55c8..3ff1009 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,7 +3,7 @@ name: CI env: CARGO_TERM_COLOR: always CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse - NIGHTLY: nightly-2025-11-06 + NIGHTLY: nightly-2026-04-17 on: push: @@ -26,14 +26,14 @@ jobs: - name: Install MSRV toolchain uses: dtolnay/rust-toolchain@master with: - toolchain: "1.88" + toolchain: "1.89" - uses: Swatinem/rust-cache@v2 with: # A stable compiler update should automatically not reuse old caches. # Add the MSRV as a stable cache key too so bumping it also gets us a # fresh cache. - shared-key: msrv1.88 + shared-key: msrv1.89 - name: Run checks run: cargo check --all-features diff --git a/CHANGELOG.md b/CHANGELOG.md index 58513d7..37f4f63 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,8 @@ Breaking changes: - Upgrade reqwest to 0.13. - The `reqwest-*` cargo features were updated to match the changes upstream. +- Upgrade ruma to 0.15.0. + - Bump the MSRV to 1.89. ## 0.17.0 diff --git a/Cargo.toml b/Cargo.toml index e1993e9..e2cd344 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,7 +9,7 @@ readme = "README.md" repository = "https://github.com/ruma/ruma-client" version = "0.17.0" edition = "2024" -rust-version = "1.88" +rust-version = "1.89" [package.metadata.docs.rs] all-features = true @@ -21,7 +21,7 @@ ignored = [ ] [features] -client-api = ["dep:as_variant", "ruma/client-api-c"] +client-api = ["ruma/client-api-c"] # HTTP clients hyper = ["dep:http-body-util", "dep:hyper", "dep:hyper-util"] @@ -36,7 +36,7 @@ reqwest-rustls = ["reqwest", "reqwest?/rustls"] reqwest-rustls-no-provider = ["reqwest", "reqwest?/rustls-no-provider"] [dependencies] -as_variant = { version = "1.2.0", optional = true } +as_variant = "1.2.0" assign = "1.1.1" async-stream = "0.3.0" bytes = "1.0.1" @@ -48,11 +48,11 @@ hyper-rustls = { version = "0.27.1", optional = true, default-features = false } hyper-tls = { version = "0.6.0", optional = true } hyper-util = { version = "0.1.3", optional = true, features = ["client-legacy", "http1", "http2", "tokio"] } reqwest = { version = "0.13", optional = true, default-features = false } -ruma = { version = "0.14.1", features = ["api"] } +ruma = { version = "0.15.0", features = ["api"] } tracing = { version = "0.1.30", default-features = false, features = ["std"] } [dev-dependencies] -ruma = { version = "0.14.1", features = ["client-api-c"] } +ruma = { version = "0.15.0", features = ["client-api-c"] } tokio-stream = "0.1.8" [lints.rust] diff --git a/src/client.rs b/src/client.rs index 35e598e..fc1fda2 100644 --- a/src/client.rs +++ b/src/client.rs @@ -16,7 +16,7 @@ use ruma::{ account::register::{self, RegistrationKind}, session::login::{self, v3::LoginInfo}, sync::sync_events, - uiaa::UserIdentifier, + uiaa::{MatrixUserIdentifier, UserIdentifier}, }, path_builder::{PathBuilder, SinglePath, VersionHistory}, }, @@ -157,9 +157,9 @@ impl Client { password: &str, device_id: Option<&DeviceId>, initial_device_display_name: Option<&str>, - ) -> Result> { + ) -> Result> { let login_info = LoginInfo::Password(login::v3::Password::new( - UserIdentifier::UserIdOrLocalpart(user.to_owned()), + UserIdentifier::Matrix(MatrixUserIdentifier::new(user.to_owned())), password.to_owned(), )); let response = self @@ -251,7 +251,7 @@ impl Client { set_presence: PresenceState, timeout: Option, ) -> impl Stream< - Item = Result>, + Item = Result>, > + '_ { try_stream! { loop { diff --git a/src/client/builder.rs b/src/client/builder.rs index c69ec90..c2e8de6 100644 --- a/src/client/builder.rs +++ b/src/client/builder.rs @@ -60,7 +60,7 @@ impl ClientBuilder { /// Unless the supported Matrix versions were manually set via /// [`supported_matrix_versions`][Self::supported_matrix_versions], this will do a /// [`get_supported_versions`] request to find out about the supported versions. - pub async fn build(self) -> Result, Error> + pub async fn build(self) -> Result, Error> where C: DefaultConstructibleHttpClient, { @@ -75,7 +75,7 @@ impl ClientBuilder { pub async fn http_client( self, http_client: C, - ) -> Result, Error> + ) -> Result, Error> where C: HttpClient, { diff --git a/src/error.rs b/src/error.rs index 96d3242..d3e5fc9 100644 --- a/src/error.rs +++ b/src/error.rs @@ -2,7 +2,8 @@ use std::fmt::{self, Debug, Display, Formatter}; -use ruma::api::error::{FromHttpResponseError, IntoHttpError}; +use as_variant::as_variant; +use ruma::api::error::{FromHttpResponseError, FromHttpResponseErrorExt as _, IntoHttpError}; /// An error that can occur during client operations. #[derive(Debug)] @@ -24,14 +25,10 @@ pub enum Error { FromHttpResponse(FromHttpResponseError), } -#[cfg(feature = "client-api")] -impl Error { +impl Error { /// If `self` is a server error in the `errcode` + `error` format expected - /// for client-server API endpoints, returns the error kind (`errcode`). - pub fn error_kind(&self) -> Option<&ruma::api::client::error::ErrorKind> { - use as_variant::as_variant; - use ruma::api::client::error::FromHttpResponseErrorExt as _; - + /// for Matrix API endpoints, returns the error kind (`errcode`). + pub fn error_kind(&self) -> Option<&ruma::api::error::ErrorKind> { as_variant!(self, Self::FromHttpResponse)?.error_kind() } }