Skip to content

Commit

Permalink
Optimize the codes
Browse files Browse the repository at this point in the history
  • Loading branch information
rmqtt committed Jan 4, 2024
1 parent 05a542b commit 8a3ec4e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ pub trait Map: Sync + Send {
prefix: P,
) -> Result<Box<dyn AsyncIterator<Item = IterItem<V>> + Send + 'a>>
where
P: AsRef<[u8]> + Send,
P: AsRef<[u8]> + Send + Sync,
V: DeserializeOwned + Sync + Send + 'a + 'static;

#[cfg(feature = "ttl")]
Expand Down Expand Up @@ -653,7 +653,7 @@ impl Map for StorageMap {
prefix: P,
) -> Result<Box<dyn AsyncIterator<Item = IterItem<V>> + Send + 'a>>
where
P: AsRef<[u8]> + Send,
P: AsRef<[u8]> + Send + Sync,
V: DeserializeOwned + Sync + Send + 'a + 'static,
{
match self {
Expand Down
5 changes: 2 additions & 3 deletions src/storage_redis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -751,7 +751,7 @@ impl Map for RedisStorageMap {
prefix: P,
) -> Result<Box<dyn AsyncIterator<Item = IterItem<V>> + Send + 'a>>
where
P: AsRef<[u8]> + Send,
P: AsRef<[u8]> + Send + Sync,
V: DeserializeOwned + Sync + Send + 'a + 'static,
{
let name = self.full_name.clone();
Expand Down Expand Up @@ -970,8 +970,7 @@ impl RedisStorageList {
.rpush(name, val)
.query_async(async_conn)
.await?;

Ok(if let Some(v) = poped { Some(v) } else { None })
Ok(poped)
} else {
Err(anyhow::Error::msg("Is full"))
}
Expand Down
2 changes: 1 addition & 1 deletion src/storage_sled.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2153,7 +2153,7 @@ impl Map for SledStorageMap {
prefix: P,
) -> Result<Box<dyn AsyncIterator<Item = IterItem<V>> + Send + 'a>>
where
P: AsRef<[u8]> + Send,
P: AsRef<[u8]> + Send + Sync,
V: DeserializeOwned + Sync + Send + 'a + 'static,
{
let this = self;
Expand Down

0 comments on commit 8a3ec4e

Please sign in to comment.