mirror of
https://github.com/matrix-org/matrix-rust-sdk.git
synced 2026-05-05 22:47:02 -04:00
refactor(sdk): Reduce the size of Error::SlidingSync.
This patch boxes the error in `Error::SlidingSync` to reduce the size of this variant (from 72 bytes to 16 bytes).
This commit is contained in:
@@ -47,7 +47,7 @@ use url::ParseError as UrlParseError;
|
||||
|
||||
use crate::{
|
||||
event_cache::EventCacheError, media::MediaError, room::reply::ReplyError,
|
||||
store_locks::LockStoreError,
|
||||
sliding_sync::Error as SlidingSyncError, store_locks::LockStoreError,
|
||||
};
|
||||
|
||||
/// Result type of the matrix-sdk.
|
||||
@@ -342,7 +342,7 @@ pub enum Error {
|
||||
|
||||
/// An error occurred within sliding-sync
|
||||
#[error(transparent)]
|
||||
SlidingSync(#[from] crate::sliding_sync::Error),
|
||||
SlidingSync(Box<SlidingSyncError>),
|
||||
|
||||
/// Attempted to call a method on a room that requires the user to have a
|
||||
/// specific membership state in the room, but the membership state is
|
||||
@@ -477,6 +477,12 @@ impl From<ScanError> for Error {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<SlidingSyncError> for Error {
|
||||
fn from(error: SlidingSyncError) -> Self {
|
||||
Error::SlidingSync(Box::new(error))
|
||||
}
|
||||
}
|
||||
|
||||
/// Error for the room key importing functionality.
|
||||
#[cfg(feature = "e2e-encryption")]
|
||||
#[derive(Error, Debug)]
|
||||
|
||||
@@ -232,7 +232,7 @@ impl SlidingSyncBuilder {
|
||||
let version = self.version.unwrap_or_else(|| client.sliding_sync_version());
|
||||
|
||||
if matches!(version, Version::None) {
|
||||
return Err(crate::error::Error::SlidingSync(Error::VersionIsMissing));
|
||||
return Err(crate::error::Error::SlidingSync(Box::new(Error::VersionIsMissing)));
|
||||
}
|
||||
|
||||
let (internal_channel_sender, _internal_channel_receiver) = channel(8);
|
||||
|
||||
Reference in New Issue
Block a user