chore(examples): Upgrade to Rust edition 2024

This commit is contained in:
Jonas Platte
2025-06-29 18:28:22 +02:00
committed by Damir Jelić
parent 06732ca71a
commit 4a1249fa96
30 changed files with 47 additions and 47 deletions

View File

@@ -1,7 +1,7 @@
[package]
name = "example-autojoin"
version = "0.1.0"
edition = "2021"
edition = "2024"
publish = false
license = "Apache-2.0"

View File

@@ -1,9 +1,9 @@
use std::{env, process::exit};
use matrix_sdk::{
config::SyncSettings, ruma::events::room::member::StrippedRoomMemberEvent, Client, Room,
Client, Room, config::SyncSettings, ruma::events::room::member::StrippedRoomMemberEvent,
};
use tokio::time::{sleep, Duration};
use tokio::time::{Duration, sleep};
async fn on_stripped_state_member(
room_member: StrippedRoomMemberEvent,

View File

@@ -1,7 +1,7 @@
[package]
name = "example-backups"
version = "0.1.0"
edition = "2021"
edition = "2024"
publish = false
license = "Apache-2.0"

View File

@@ -1,10 +1,10 @@
use anyhow::Result;
use clap::Parser;
use futures_util::{pin_mut, StreamExt};
use futures_util::{StreamExt, pin_mut};
use matrix_sdk::{
Client,
config::SyncSettings,
encryption::{backups::BackupState, secret_storage::SecretStore},
Client,
};
use url::Url;

View File

@@ -1,7 +1,7 @@
[package]
name = "example-command-bot"
version = "0.1.0"
edition = "2021"
edition = "2024"
publish = false
license = "Apache-2.0"

View File

@@ -1,11 +1,11 @@
use std::{env, process::exit};
use matrix_sdk::{
Client, Room, RoomState,
config::SyncSettings,
ruma::events::room::message::{
MessageType, OriginalSyncRoomMessageEvent, RoomMessageEventContent,
},
Client, Room, RoomState,
};
async fn on_room_message(event: OriginalSyncRoomMessageEvent, room: Room) {

View File

@@ -1,7 +1,7 @@
[package]
name = "example-cross-signing-bootstrap"
version = "0.1.0"
edition = "2021"
edition = "2024"
publish = false
license = "Apache-2.0"

View File

@@ -6,10 +6,10 @@ use std::{
use anyhow::Result;
use matrix_sdk::{
Client, LoopCtrl,
config::SyncSettings,
encryption::CrossSigningResetAuthType,
ruma::{api::client::uiaa, OwnedUserId},
Client, LoopCtrl,
ruma::{OwnedUserId, api::client::uiaa},
};
use url::Url;

View File

@@ -1,7 +1,7 @@
[package]
name = "example-custom-events"
version = "0.1.0"
edition = "2021"
edition = "2024"
publish = false
license = "Apache-2.0"

View File

@@ -13,15 +13,17 @@ use std::{
env,
process::exit,
sync::{
atomic::{AtomicU64, Ordering},
Arc,
atomic::{AtomicU64, Ordering},
},
};
use matrix_sdk::{
Client, Room, RoomState,
config::SyncSettings,
event_handler::Ctx,
ruma::{
OwnedEventId,
events::{
macros::EventContent,
room::{
@@ -29,12 +31,10 @@ use matrix_sdk::{
message::{MessageType, OriginalSyncRoomMessageEvent},
},
},
OwnedEventId,
},
Client, Room, RoomState,
};
use serde::{Deserialize, Serialize};
use tokio::time::{sleep, Duration};
use tokio::time::{Duration, sleep};
// We use ruma to define our custom events. Just declare the events content
// by deriving from `EventContent` and define `ruma_events` for the metadata

View File

@@ -1,7 +1,7 @@
[package]
name = "example-emoji-verification"
version = "0.1.0"
edition = "2021"
edition = "2024"
publish = false
license = "Apache-2.0"

View File

@@ -4,19 +4,19 @@ use anyhow::Result;
use clap::Parser;
use futures_util::stream::StreamExt;
use matrix_sdk::{
Client,
config::SyncSettings,
encryption::verification::{
format_emojis, Emoji, SasState, SasVerification, Verification, VerificationRequest,
VerificationRequestState,
Emoji, SasState, SasVerification, Verification, VerificationRequest,
VerificationRequestState, format_emojis,
},
ruma::{
UserId,
events::{
key::verification::request::ToDeviceKeyVerificationRequestEvent,
room::message::{MessageType, OriginalSyncRoomMessageEvent},
},
UserId,
},
Client,
};
use url::Url;

View File

@@ -1,7 +1,7 @@
[package]
name = "example-get-profiles"
version = "0.1.0"
edition = "2021"
edition = "2024"
publish = false
license = "Apache-2.0"

View File

@@ -1,8 +1,8 @@
use std::{env, process::exit};
use matrix_sdk::{
ruma::{api::client::profile, OwnedMxcUri, UserId},
Client, Result as MatrixResult,
ruma::{OwnedMxcUri, UserId, api::client::profile},
};
use url::Url;

View File

@@ -1,7 +1,7 @@
[package]
name = "example-getting-started"
version = "0.1.0"
edition = "2021"
edition = "2024"
publish = false
license = "Apache-2.0"

View File

@@ -13,14 +13,14 @@
use std::{env, process::exit};
use matrix_sdk::{
Client, Room, RoomState,
config::SyncSettings,
ruma::events::room::{
member::StrippedRoomMemberEvent,
message::{MessageType, OriginalSyncRoomMessageEvent, RoomMessageEventContent},
},
Client, Room, RoomState,
};
use tokio::time::{sleep, Duration};
use tokio::time::{Duration, sleep};
/// This is the starting point of the app. `main` is called by rust binaries to
/// run the program in this case, we use tokio (a reactor) to allow us to use

View File

@@ -1,7 +1,7 @@
[package]
name = "example-image-bot"
version = "0.1.0"
edition = "2021"
edition = "2024"
publish = false
license = "Apache-2.0"

View File

@@ -1,10 +1,10 @@
use std::{env, fs, process::exit};
use matrix_sdk::{
Client, Room, RoomState,
attachment::AttachmentConfig,
config::SyncSettings,
ruma::events::room::message::{MessageType, OriginalSyncRoomMessageEvent},
Client, Room, RoomState,
};
use url::Url;

View File

@@ -1,7 +1,7 @@
[package]
name = "example-login"
version = "0.1.0"
edition = "2021"
edition = "2024"
publish = false
license = "Apache-2.0"

View File

@@ -6,12 +6,12 @@ use std::{
use anyhow::anyhow;
use matrix_sdk::{
Client, Room, RoomState,
config::SyncSettings,
ruma::{
api::client::session::get_login_types::v3::{IdentityProvider, LoginType},
events::room::message::{MessageType, OriginalSyncRoomMessageEvent},
},
Client, Room, RoomState,
};
use url::Url;

View File

@@ -1,7 +1,7 @@
[package]
name = "example-oauth-cli"
version = "0.1.0"
edition = "2021"
edition = "2024"
publish = false
license = "Apache-2.0"

View File

@@ -22,24 +22,24 @@ use std::{
use anyhow::bail;
use futures_util::StreamExt;
use matrix_sdk::{
Client, ClientBuildError, Result, RoomState,
authentication::oauth::{
error::OAuthClientRegistrationError,
registration::{ApplicationType, ClientMetadata, Localized, OAuthGrantType},
AccountManagementActionFull, ClientId, OAuthAuthorizationData, OAuthError, OAuthSession,
UrlOrQuery, UserSession,
error::OAuthClientRegistrationError,
registration::{ApplicationType, ClientMetadata, Localized, OAuthGrantType},
},
config::SyncSettings,
encryption::{recovery::RecoveryState, CrossSigningResetAuthType},
encryption::{CrossSigningResetAuthType, recovery::RecoveryState},
room::Room,
ruma::{
events::room::message::{MessageType, OriginalSyncRoomMessageEvent},
serde::Raw,
},
utils::local_server::{LocalServerBuilder, LocalServerRedirectHandle, QueryString},
Client, ClientBuildError, Result, RoomState,
};
use matrix_sdk_ui::sync_service::SyncService;
use rand::{distributions::Alphanumeric, thread_rng, Rng};
use rand::{Rng, distributions::Alphanumeric, thread_rng};
use serde::{Deserialize, Serialize};
use tokio::{fs, io::AsyncBufReadExt as _};
use url::Url;

View File

@@ -1,7 +1,7 @@
[package]
name = "example-persist-session"
version = "0.1.0"
edition = "2021"
edition = "2024"
publish = false
license = "Apache-2.0"

View File

@@ -4,15 +4,15 @@ use std::{
};
use matrix_sdk::{
Client, Error, LoopCtrl, Room, RoomState,
authentication::matrix::MatrixSession,
config::SyncSettings,
ruma::{
api::client::filter::FilterDefinition,
events::room::message::{MessageType, OriginalSyncRoomMessageEvent},
},
Client, Error, LoopCtrl, Room, RoomState,
};
use rand::{distributions::Alphanumeric, thread_rng, Rng};
use rand::{Rng, distributions::Alphanumeric, thread_rng};
use serde::{Deserialize, Serialize};
use tokio::fs;

View File

@@ -1,7 +1,7 @@
[package]
name = "example-qr-login"
version = "0.1.0"
edition = "2021"
edition = "2024"
publish = false
license = "Apache-2.0"

View File

@@ -1,15 +1,15 @@
use std::io::Write;
use anyhow::{bail, Context, Result};
use anyhow::{Context, Result, bail};
use clap::Parser;
use futures_util::StreamExt;
use matrix_sdk::{
Client,
authentication::oauth::{
qrcode::{LoginProgress, QrCodeData, QrCodeModeData},
registration::{ApplicationType, ClientMetadata, Localized, OAuthGrantType},
},
ruma::serde::Raw,
Client,
};
use url::Url;

View File

@@ -1,7 +1,7 @@
[package]
name = "example-secret-storage"
version = "0.1.0"
edition = "2021"
edition = "2024"
publish = false
license = "Apache-2.0"

View File

@@ -1,10 +1,10 @@
use anyhow::Result;
use clap::{Parser, Subcommand};
use matrix_sdk::{
AuthSession, Client, SessionMeta, SessionTokens,
authentication::matrix::MatrixSession,
encryption::secret_storage::SecretStore,
ruma::{events::secret::request::SecretName, OwnedDeviceId, OwnedUserId},
AuthSession, Client, SessionMeta, SessionTokens,
ruma::{OwnedDeviceId, OwnedUserId, events::secret::request::SecretName},
};
use url::Url;

View File

@@ -1,7 +1,7 @@
[package]
name = "example-timeline"
version = "0.1.0"
edition = "2021"
edition = "2024"
publish = false
license = "Apache-2.0"

View File

@@ -1,7 +1,7 @@
use anyhow::Result;
use clap::Parser;
use futures_util::StreamExt;
use matrix_sdk::{config::SyncSettings, ruma::OwnedRoomId, Client};
use matrix_sdk::{Client, config::SyncSettings, ruma::OwnedRoomId};
use matrix_sdk_ui::timeline::RoomExt;
use url::Url;