Skip to content

Commit 45b2f6c

Browse files
committed
SharedCfg is not Copy anymore
1 parent a024399 commit 45b2f6c

File tree

24 files changed

+289
-246
lines changed

24 files changed

+289
-246
lines changed

CHANGES.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changes
22

3+
## [5.5.0] - 2026-02-16
4+
5+
* SharedCfg is not Copy anymore
6+
37
## [5.4.0] - 2026-01-29
48

59
* Use ntex_dispatcher::Dispatcher instead of ntex-io

Cargo.toml

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "ntex-amqp"
3-
version = "5.4.0"
3+
version = "5.5.0"
44
authors = ["ntex contributors <team@ntex.rs>"]
55
description = "AMQP 1.0 Client/Server framework"
66
documentation = "https://docs.rs/ntex-amqp"
@@ -18,6 +18,16 @@ members = [
1818
"codec",
1919
]
2020

21+
[workspace.lints.rust]
22+
async_fn_in_trait = { level = "allow", priority = -1 }
23+
rust_2018_idioms = "deny"
24+
warnings = "deny"
25+
unreachable_pub = "deny"
26+
#missing_debug_implementations = "deny"
27+
28+
[lints]
29+
workspace = true
30+
2131
[features]
2232
default = []
2333

@@ -27,14 +37,14 @@ frame-trace = []
2737
[dependencies]
2838
ntex-amqp-codec = "2.0.0"
2939

30-
ntex-bytes = "1.4"
40+
ntex-bytes = "1.5"
3141
ntex-dispatcher = "3"
3242
ntex-router = "1"
33-
ntex-rt = "3.5"
34-
ntex-io = "3.5"
35-
ntex-net = "3.5"
43+
ntex-rt = "3.7"
44+
ntex-io = "3.8"
45+
ntex-net = "3.6"
3646
ntex-util = "3.4"
37-
ntex-service = "4"
47+
ntex-service = "4.4"
3848

3949
bitflags = "2"
4050
log = "0.4"

codec/Cargo.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,11 @@ license = "MIT/Apache-2.0"
77
edition = "2024"
88
rust-version = "1.88"
99

10+
[lints]
11+
workspace = true
12+
1013
[dependencies]
11-
ntex-bytes = "1.4"
14+
ntex-bytes = "1.5"
1215
ntex-codec = "1.1"
1316
ntex-util = "3"
1417
byteorder = "1"

codec/src/codec/mod.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ impl<T: DecodeFormatted> Decode for T {
5959
}
6060
}
6161

62-
pub fn decode_format_code(input: &mut Bytes) -> Result<u8, AmqpParseError> {
62+
pub(crate) fn decode_format_code(input: &mut Bytes) -> Result<u8, AmqpParseError> {
6363
decode_check_len!(input, 1);
6464
let code = input.get_u8();
6565
Ok(code)
@@ -108,18 +108,21 @@ pub mod format_codes {
108108
pub const FORMATCODE_ARRAY32: u8 = 0xf0;
109109
}
110110

111-
pub use self::format_codes::*;
111+
pub(crate) use self::format_codes::*;
112112

113+
#[derive(Copy, Clone, Debug)]
113114
pub struct ListHeader {
114115
pub size: u32,
115116
pub count: u32,
116117
}
117118

119+
#[derive(Copy, Clone, Debug)]
118120
pub struct MapHeader {
119121
pub size: u32,
120122
pub count: u32,
121123
}
122124

125+
#[derive(Copy, Clone, Debug)]
123126
pub struct ArrayHeader {
124127
pub size: u32,
125128
pub count: u32,

codec/src/error.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
use crate::protocol::{AmqpError, ProtocolId};
2-
pub use crate::protocol::{Error, ErrorInner};
1+
use crate::protocol::{AmqpError, Error, ErrorInner, ProtocolId};
32
use crate::types::Descriptor;
43

54
#[derive(Debug, Clone, thiserror::Error)]

codec/src/framing.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
use super::protocol;
22

33
/// Length in bytes of the fixed frame header
4-
pub const HEADER_LEN: usize = 8;
4+
pub(crate) const HEADER_LEN: usize = 8;
55

66
/// AMQP Frame type marker (0)
7-
pub const FRAME_TYPE_AMQP: u8 = 0x00;
8-
pub const FRAME_TYPE_SASL: u8 = 0x01;
7+
pub(crate) const FRAME_TYPE_AMQP: u8 = 0x00;
8+
pub(crate) const FRAME_TYPE_SASL: u8 = 0x01;
99

1010
/// Represents an AMQP Frame
1111
#[derive(Clone, Debug, PartialEq, Eq)]

codec/src/protocol/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use crate::types::{
1313
use crate::{HashMap, error::AmqpParseError, message::Message};
1414

1515
impl fmt::Display for Error {
16-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
16+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1717
write!(f, "{self:?}")
1818
}
1919
}

codec/src/types/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ impl PartialEq<str> for Str {
186186
}
187187

188188
impl fmt::Debug for Str {
189-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
189+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
190190
self.0.fmt(f)
191191
}
192192
}

src/client/connector.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -110,14 +110,14 @@ where
110110
let io = IoBoxed::from(io);
111111

112112
if let Some(auth) = sasl {
113-
_connect_sasl(io, auth, self.config, hostname).await
113+
connect_sasl_inner(io, auth, self.config.clone(), hostname).await
114114
} else {
115-
_connect_plain(io, self.config, hostname).await
115+
connect_plain_inner(io, self.config.clone(), hostname).await
116116
}
117117
};
118118
timeout_checked(self.config.handshake_timeout, fut)
119119
.await
120-
.map_err(|_| ConnectError::HandshakeTimeout)
120+
.map_err(|()| ConnectError::HandshakeTimeout)
121121
.and_then(|res| res)
122122
}
123123
}
@@ -136,7 +136,7 @@ where
136136
) -> Result<Client, ConnectError> {
137137
log::trace!("{}: Negotiation client protocol id: Amqp", io.tag());
138138

139-
_connect_plain(io, self.config, hostname).await
139+
connect_plain_inner(io, self.config.clone(), hostname).await
140140
}
141141

142142
/// Negotiate amqp sasl protocol over opened socket
@@ -148,11 +148,11 @@ where
148148
) -> Result<Client, ConnectError> {
149149
log::trace!("{}: Negotiation client protocol id: Amqp", io.tag());
150150

151-
_connect_sasl(io, auth, self.config, hostname).await
151+
connect_sasl_inner(io, auth, self.config.clone(), hostname).await
152152
}
153153
}
154154

155-
async fn _connect_sasl(
155+
async fn connect_sasl_inner(
156156
io: IoBoxed,
157157
auth: SaslAuth,
158158
config: Cfg<AmqpServiceConfig>,
@@ -204,10 +204,10 @@ async fn _connect_sasl(
204204
return Err(ConnectError::Disconnected);
205205
}
206206

207-
_connect_plain(io, config, hostname).await
207+
connect_plain_inner(io, config, hostname).await
208208
}
209209

210-
async fn _connect_plain(
210+
async fn connect_plain_inner(
211211
io: IoBoxed,
212212
config: Cfg<AmqpServiceConfig>,
213213
hostname: Option<ByteString>,
@@ -250,7 +250,7 @@ async fn _connect_plain(
250250
if let Frame::Open(open) = frame.performative() {
251251
log::trace!("{}: Open confirmed: {:?}", io.tag(), open);
252252
let remote_config = config.from_remote(open);
253-
let connection = Connection::new(io.get_ref(), &config, &remote_config);
253+
let connection = Connection::new(io.get_ref(), config, &remote_config);
254254
let client = Client::new(io, codec, connection, remote_config);
255255
Ok(client)
256256
} else {

src/client/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ pub struct Connect<T: Address> {
1818
}
1919

2020
impl<T: Address> Connect<T> {
21-
#[inline]
2221
pub fn new(addr: T) -> Self {
2322
Self {
2423
addr,
@@ -27,7 +26,7 @@ impl<T: Address> Connect<T> {
2726
}
2827
}
2928

30-
#[inline]
29+
#[must_use]
3130
/// Use Sasl auth
3231
pub fn sasl_auth(
3332
mut self,
@@ -43,6 +42,7 @@ impl<T: Address> Connect<T> {
4342
self
4443
}
4544

45+
#[must_use]
4646
/// Set connection hostname
4747
///
4848
/// Hostname is not set by default

0 commit comments

Comments
 (0)