Skip to content

Commit 1cb9ec4

Browse files
p4rtridgeDavidBM
authored andcommitted
update deps
1 parent cd835d9 commit 1cb9ec4

File tree

7 files changed

+30
-29
lines changed

7 files changed

+30
-29
lines changed

Cargo.toml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,15 @@ readme = "README.md"
1212

1313
[dependencies]
1414
lazy_static = "^1"
15-
rand = "^0.8"
15+
rand = "^0.9"
1616
radix_fmt = "^1"
17-
bb8 = "^0.8"
18-
thiserror = "^1"
19-
redis = { version = "^0.27", default-features = false, features = [
17+
bb8 = "^0.9"
18+
thiserror = "^2"
19+
redis = { version = "^0.28", default-features = false, features = [
2020
"acl",
2121
"keep-alive",
2222
"script",
2323
] }
24-
async-trait = "^0.1"
2524
tokio = { version = "^1", optional = true }
2625

2726
[dev-dependencies]

src/functions.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -586,7 +586,7 @@ impl<T: ConnectionLike> RsmqFunctions<T> {
586586
fn make_id(len: usize) -> RsmqResult<String> {
587587
let possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
588588

589-
let mut rng = rand::thread_rng();
589+
let mut rng = rand::rng();
590590

591591
let mut id = String::with_capacity(len);
592592

src/multiplexed_facade.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ impl Rsmq {
6464
}
6565
}
6666

67-
#[async_trait::async_trait]
6867
impl RsmqConnection for Rsmq {
6968
async fn change_message_visibility(
7069
&mut self,

src/pooled_facade.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ use crate::r#trait::RsmqConnection;
33
use crate::types::RedisBytes;
44
use crate::types::{RsmqMessage, RsmqOptions, RsmqQueueAttributes};
55
use crate::RsmqResult;
6-
use async_trait::async_trait;
76
use core::convert::TryFrom;
87
use redis::RedisError;
98
use std::marker::PhantomData;
@@ -20,7 +19,6 @@ impl RedisConnectionManager {
2019
}
2120
}
2221

23-
#[async_trait]
2422
impl bb8::ManageConnection for RedisConnectionManager {
2523
type Connection = redis::aio::MultiplexedConnection;
2624
type Error = RedisError;
@@ -142,7 +140,6 @@ impl PooledRsmq {
142140
}
143141
}
144142

145-
#[async_trait::async_trait]
146143
impl RsmqConnection for PooledRsmq {
147144
async fn change_message_visibility(
148145
&mut self,

src/sync_facade.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ impl RsmqSync {
6666
}
6767
}
6868

69-
#[async_trait::async_trait]
7069
impl RsmqConnection for RsmqSync {
7170
async fn change_message_visibility(
7271
&mut self,

src/trait.rs

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,19 @@ use crate::types::RedisBytes;
22
use crate::types::{RsmqMessage, RsmqQueueAttributes};
33
use crate::RsmqResult;
44
use core::convert::TryFrom;
5+
use std::future::Future;
56
use std::time::Duration;
67

7-
#[async_trait::async_trait]
88
pub trait RsmqConnection {
99
/// Change the hidden time of a already sent message.
1010
///
1111
/// `hidden` has a max time of 9_999_999 for compatibility reasons to this library JS version counterpart
12-
async fn change_message_visibility(
12+
fn change_message_visibility(
1313
&mut self,
1414
qname: &str,
1515
message_id: &str,
1616
hidden: Duration,
17-
) -> RsmqResult<()>;
17+
) -> impl Future<Output = RsmqResult<()>> + Send;
1818

1919
/// Creates a new queue. Attributes can be later modified with "set_queue_attributes" method
2020
///
@@ -25,53 +25,60 @@ pub trait RsmqConnection {
2525
///
2626
/// maxsize: Maximum size in bytes of each message in the queue. Needs to be between 1024 or 65536 or -1 (unlimited
2727
/// size)
28-
async fn create_queue(
28+
fn create_queue(
2929
&mut self,
3030
qname: &str,
3131
hidden: Option<Duration>,
3232
delay: Option<Duration>,
3333
maxsize: Option<i32>,
34-
) -> RsmqResult<()>;
34+
) -> impl Future<Output = RsmqResult<()>> + Send;
3535

3636
/// Deletes a message from the queue.
3737
///
3838
/// Important to use when you are using receive_message.
39-
async fn delete_message(&mut self, qname: &str, id: &str) -> RsmqResult<bool>;
39+
fn delete_message(
40+
&mut self,
41+
qname: &str,
42+
id: &str,
43+
) -> impl Future<Output = RsmqResult<bool>> + Send;
4044

4145
/// Deletes the queue and all the messages on it
42-
async fn delete_queue(&mut self, qname: &str) -> RsmqResult<()>;
46+
fn delete_queue(&mut self, qname: &str) -> impl Future<Output = RsmqResult<()>> + Send;
4347

4448
/// Returns the queue attributes and statistics
45-
async fn get_queue_attributes(&mut self, qname: &str) -> RsmqResult<RsmqQueueAttributes>;
49+
fn get_queue_attributes(
50+
&mut self,
51+
qname: &str,
52+
) -> impl Future<Output = RsmqResult<RsmqQueueAttributes>> + Send;
4653

4754
/// Returns a list of queues in the namespace
48-
async fn list_queues(&mut self) -> RsmqResult<Vec<String>>;
55+
fn list_queues(&mut self) -> impl Future<Output = RsmqResult<Vec<String>>> + Send;
4956

5057
/// Deletes and returns a message. Be aware that using this you may end with deleted & unprocessed messages.
51-
async fn pop_message<E: TryFrom<RedisBytes, Error = Vec<u8>>>(
58+
fn pop_message<E: TryFrom<RedisBytes, Error = Vec<u8>>>(
5259
&mut self,
5360
qname: &str,
54-
) -> RsmqResult<Option<RsmqMessage<E>>>;
61+
) -> impl Future<Output = RsmqResult<Option<RsmqMessage<E>>>> + Send;
5562

5663
/// Returns a message. The message stays hidden for some time (defined by "hidden" argument or the queue
5764
/// settings). After that time, the message will be redelivered. In order to avoid the redelivery, you need to use
5865
/// the "delete_message" after this function.
5966
///
6067
/// `hidden` has a max time of 9_999_999 for compatibility reasons to this library JS version counterpart.
61-
async fn receive_message<E: TryFrom<RedisBytes, Error = Vec<u8>>>(
68+
fn receive_message<E: TryFrom<RedisBytes, Error = Vec<u8>>>(
6269
&mut self,
6370
qname: &str,
6471
hidden: Option<Duration>,
65-
) -> RsmqResult<Option<RsmqMessage<E>>>;
72+
) -> impl Future<Output = RsmqResult<Option<RsmqMessage<E>>>> + Send;
6673

6774
/// Sends a message to the queue. The message will be delayed some time (controlled by the "delayed" argument or
6875
/// the queue settings) before being delivered to a client.
69-
async fn send_message<E: Into<RedisBytes> + Send>(
76+
fn send_message<E: Into<RedisBytes> + Send>(
7077
&mut self,
7178
qname: &str,
7279
message: E,
7380
delay: Option<Duration>,
74-
) -> RsmqResult<String>;
81+
) -> impl Future<Output = RsmqResult<String>> + Send;
7582

7683
/// Modify the queue attributes. Keep in mind that "hidden" and "delay" can be overwritten when the message
7784
/// is sent. "hidden" can be changed by the method "change_message_visibility"
@@ -83,11 +90,11 @@ pub trait RsmqConnection {
8390
///
8491
/// maxsize: Maximum size in bytes of each message in the queue. Needs to be between 1024 or 65536 or -1 (unlimited
8592
/// size)
86-
async fn set_queue_attributes(
93+
fn set_queue_attributes(
8794
&mut self,
8895
qname: &str,
8996
hidden: Option<Duration>,
9097
delay: Option<Duration>,
9198
maxsize: Option<i64>,
92-
) -> RsmqResult<RsmqQueueAttributes>;
99+
) -> impl Future<Output = RsmqResult<RsmqQueueAttributes>> + Send;
93100
}

tests/support/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ impl TestContext {
113113
}
114114
}
115115
}
116-
redis::cmd("FLUSHDB").execute(&mut con);
116+
let _ = redis::cmd("FLUSHDB").exec(&mut con);
117117

118118
TestContext { server, client }
119119
}

0 commit comments

Comments
 (0)