diff --git a/crates/matrix-sdk/src/encryption/futures.rs b/crates/matrix-sdk/src/encryption/futures.rs index 30ef5da23cc..a31c84851f5 100644 --- a/crates/matrix-sdk/src/encryption/futures.rs +++ b/crates/matrix-sdk/src/encryption/futures.rs @@ -27,16 +27,16 @@ use ruma::events::room::{EncryptedFile, EncryptedFileInit}; use crate::{Client, Result, TransmissionProgress}; -/// Future returned by [`Client::prepare_encrypted_file`]. +/// Future returned by [`Client::upload_encrypted_file`]. #[allow(missing_debug_implementations)] -pub struct PrepareEncryptedFile<'a, R: ?Sized> { +pub struct UploadEncryptedFile<'a, R: ?Sized> { client: &'a Client, content_type: &'a mime::Mime, reader: &'a mut R, send_progress: SharedObservable, } -impl<'a, R: ?Sized> PrepareEncryptedFile<'a, R> { +impl<'a, R: ?Sized> UploadEncryptedFile<'a, R> { pub(crate) fn new(client: &'a Client, content_type: &'a mime::Mime, reader: &'a mut R) -> Self { Self { client, content_type, reader, send_progress: Default::default() } } @@ -63,7 +63,7 @@ impl<'a, R: ?Sized> PrepareEncryptedFile<'a, R> { } } -impl<'a, R> IntoFuture for PrepareEncryptedFile<'a, R> +impl<'a, R> IntoFuture for UploadEncryptedFile<'a, R> where R: Read + Send + ?Sized + 'a, { diff --git a/crates/matrix-sdk/src/encryption/mod.rs b/crates/matrix-sdk/src/encryption/mod.rs index 00b1b10d586..0466716b3e6 100644 --- a/crates/matrix-sdk/src/encryption/mod.rs +++ b/crates/matrix-sdk/src/encryption/mod.rs @@ -58,7 +58,7 @@ use vodozemac::Curve25519PublicKey; use self::{ backups::{types::BackupClientState, Backups}, - futures::PrepareEncryptedFile, + futures::UploadEncryptedFile, identities::{Device, DeviceUpdates, IdentityUpdates, UserDevices, UserIdentity}, recovery::{Recovery, RecoveryState}, secret_storage::SecretStorage, @@ -438,17 +438,17 @@ impl Client { /// # let client = Client::new(homeserver).await?; /// # let room = client.get_room(&room_id!("!test:example.com")).unwrap(); /// let mut reader = std::io::Cursor::new(b"Hello, world!"); - /// let encrypted_file = client.prepare_encrypted_file(&mime::TEXT_PLAIN, &mut reader).await?; + /// let encrypted_file = client.upload_encrypted_file(&mime::TEXT_PLAIN, &mut reader).await?; /// /// room.send(CustomEventContent { encrypted_file }).await?; /// # anyhow::Ok(()) }; /// ``` - pub fn prepare_encrypted_file<'a, R: Read + ?Sized + 'a>( + pub fn upload_encrypted_file<'a, R: Read + ?Sized + 'a>( &'a self, content_type: &'a mime::Mime, reader: &'a mut R, - ) -> PrepareEncryptedFile<'a, R> { - PrepareEncryptedFile::new(self, content_type, reader) + ) -> UploadEncryptedFile<'a, R> { + UploadEncryptedFile::new(self, content_type, reader) } /// Encrypt and upload the file and thumbnails, and return the source @@ -465,7 +465,7 @@ impl Client { let upload_attachment = async { let mut cursor = Cursor::new(data); - self.prepare_encrypted_file(content_type, &mut cursor) + self.upload_encrypted_file(content_type, &mut cursor) .with_send_progress_observable(send_progress) .await }; @@ -491,7 +491,7 @@ impl Client { let mut cursor = Cursor::new(thumbnail.data); let file = self - .prepare_encrypted_file(content_type, &mut cursor) + .upload_encrypted_file(content_type, &mut cursor) .with_send_progress_observable(send_progress) .await?;