Skip to content

Commit 80c6780

Browse files
Upgrade rand and tabled
1 parent 842df41 commit 80c6780

File tree

4 files changed

+53
-50
lines changed

4 files changed

+53
-50
lines changed

CHANGELOG.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
# Rust Client for the RabbitMQ HTTP API Change Log
22

3-
## v0.23.0 (in development)
3+
## v0.24.0 (in development)
4+
5+
No (documented) changes yet.
6+
7+
8+
## v0.23.0 (Feb 24, 2025)
49

510
### Breaking Changes
611

Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ doctest = false
1414

1515
[dependencies]
1616
serde = { version = "1.0", features = ["derive"] }
17-
serde-aux = "4.5"
17+
serde-aux = "4.6"
1818
serde_json = "1"
19-
rand = "0.8"
19+
rand = "0.9"
2020
ring = "0.17"
2121
rbase64 = "2"
2222
percent-encoding = { version = "2", optional = true }
23-
tabled = { version = "0.17", features = ["derive", "macros"], optional = true }
23+
tabled = { version = "0.18", features = ["derive", "macros"], optional = true }
2424

2525
reqwest = { version = "0.12.12", features = [
2626
"json",

src/password_hashing.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
14-
use rand::distributions::{Alphanumeric, DistString};
14+
use rand::RngCore;
1515
use ring::digest::{Context, SHA256};
1616

1717
const SALT_LENGTH: usize = 4;
@@ -21,9 +21,10 @@ const SALT_LENGTH: usize = 4;
2121
/// See the [Credentials and Passwords guide](https://rabbitmq.com/docs/passwords/).
2222
pub fn salt() -> Vec<u8> {
2323
// salts are 32 bit long
24-
let sample = Alphanumeric.sample_string(&mut rand::thread_rng(), SALT_LENGTH);
25-
let bytes = sample.as_bytes();
26-
Vec::from(bytes)
24+
let mut buf: [u8; SALT_LENGTH] = [0; SALT_LENGTH];
25+
let mut rng = rand::rng();
26+
rng.fill_bytes(&mut buf);
27+
Vec::from(&buf)
2728
}
2829

2930
/// Produces a SHA-256 hashed, salted passowrd hash.

src/responses.rs

Lines changed: 39 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ pub struct StreamConsumer {
6565
pub consumed: u64,
6666
pub offset_lag: u64,
6767
pub offset: u64,
68-
#[cfg_attr(feature = "tabled", tabled(display_with = "display_arg_table"))]
68+
#[cfg_attr(feature = "tabled", tabled(display = "display_arg_table"))]
6969
pub properties: XArguments,
7070
}
7171

@@ -370,9 +370,9 @@ impl fmt::Display for NodeMemoryBreakdown {
370370
#[cfg_attr(feature = "tabled", derive(Tabled))]
371371
pub struct OAuthConfiguration {
372372
pub oauth_enabled: bool,
373-
#[cfg_attr(feature = "tabled", tabled(display_with = "display_option"))]
373+
#[cfg_attr(feature = "tabled", tabled(display = "display_option"))]
374374
pub oauth_client_id: Option<String>,
375-
#[cfg_attr(feature = "tabled", tabled(display_with = "display_option"))]
375+
#[cfg_attr(feature = "tabled", tabled(display = "display_option"))]
376376
pub oauth_provider_url: Option<String>,
377377
}
378378

@@ -396,14 +396,14 @@ pub struct VirtualHost {
396396
/// Virtual host name
397397
pub name: String,
398398
/// Optional tags
399-
#[cfg_attr(feature = "tabled", tabled(display_with = "display_option"))]
399+
#[cfg_attr(feature = "tabled", tabled(display = "display_option"))]
400400
pub tags: Option<TagList>,
401401
/// Optional description
402-
#[cfg_attr(feature = "tabled", tabled(display_with = "display_option"))]
402+
#[cfg_attr(feature = "tabled", tabled(display = "display_option"))]
403403
pub description: Option<String>,
404404
/// Default queue type used in this virtual host when clients
405405
/// do not explicitly specify one
406-
#[cfg_attr(feature = "tabled", tabled(display_with = "display_option"))]
406+
#[cfg_attr(feature = "tabled", tabled(display = "display_option"))]
407407
pub default_queue_type: Option<String>,
408408
/// All virtual host metadata combined
409409
#[cfg_attr(feature = "tabled", tabled(skip))]
@@ -487,7 +487,7 @@ pub struct Connection {
487487
#[serde(rename(deserialize = "peer_port"))]
488488
pub client_port: u32,
489489
/// Maximum number of channels that can be opened on this connection.
490-
#[cfg_attr(feature = "tabled", tabled(display_with = "display_option"))]
490+
#[cfg_attr(feature = "tabled", tabled(display = "display_option"))]
491491
pub channel_max: Option<u16>,
492492
/// How many channels are opened on this connection.
493493
#[serde(rename(deserialize = "channels"))]
@@ -664,19 +664,19 @@ pub struct QueueInfo {
664664
pub durable: bool,
665665
pub auto_delete: bool,
666666
pub exclusive: bool,
667-
#[cfg_attr(feature = "tabled", tabled(display_with = "display_arg_table"))]
667+
#[cfg_attr(feature = "tabled", tabled(display = "display_arg_table"))]
668668
pub arguments: XArguments,
669669

670670
#[serde(default = "undefined")]
671671
pub node: String,
672672
#[serde(default)]
673673
pub state: String,
674674
// only quorum queues and streams will have this
675-
#[cfg_attr(feature = "tabled", tabled(display_with = "display_option"))]
675+
#[cfg_attr(feature = "tabled", tabled(display = "display_option"))]
676676
pub leader: Option<String>,
677-
#[cfg_attr(feature = "tabled", tabled(display_with = "display_option"))]
677+
#[cfg_attr(feature = "tabled", tabled(display = "display_option"))]
678678
pub members: Option<NodeList>,
679-
#[cfg_attr(feature = "tabled", tabled(display_with = "display_option"))]
679+
#[cfg_attr(feature = "tabled", tabled(display = "display_option"))]
680680
pub online: Option<NodeList>,
681681

682682
#[serde(default)]
@@ -689,7 +689,7 @@ pub struct QueueInfo {
689689
#[cfg_attr(feature = "tabled", tabled(skip))]
690690
pub exclusive_consumer_tag: Option<String>,
691691

692-
#[cfg_attr(feature = "tabled", tabled(display_with = "display_option"))]
692+
#[cfg_attr(feature = "tabled", tabled(display = "display_option"))]
693693
pub policy: Option<String>,
694694

695695
#[serde(default)]
@@ -759,7 +759,7 @@ pub struct ExchangeInfo {
759759
pub exchange_type: String,
760760
pub durable: bool,
761761
pub auto_delete: bool,
762-
#[cfg_attr(feature = "tabled", tabled(display_with = "display_arg_table"))]
762+
#[cfg_attr(feature = "tabled", tabled(display = "display_arg_table"))]
763763
pub arguments: XArguments,
764764
}
765765

@@ -775,7 +775,7 @@ pub struct ExchangeInfoWithoutVirtualHost {
775775
pub exchange_type: String,
776776
pub durable: bool,
777777
pub auto_delete: bool,
778-
#[cfg_attr(feature = "tabled", tabled(display_with = "display_arg_table"))]
778+
#[cfg_attr(feature = "tabled", tabled(display = "display_arg_table"))]
779779
pub arguments: XArguments,
780780
}
781781

@@ -788,9 +788,9 @@ pub struct BindingInfo {
788788
pub destination: String,
789789
pub destination_type: BindingDestinationType,
790790
pub routing_key: String,
791-
#[cfg_attr(feature = "tabled", tabled(display_with = "display_arg_table"))]
791+
#[cfg_attr(feature = "tabled", tabled(display = "display_arg_table"))]
792792
pub arguments: XArguments,
793-
#[cfg_attr(feature = "tabled", tabled(display_with = "display_option"))]
793+
#[cfg_attr(feature = "tabled", tabled(display = "display_option"))]
794794
pub properties_key: Option<String>,
795795
}
796796

@@ -805,9 +805,9 @@ pub struct BindingInfoWithoutVirtualHost {
805805
pub destination: String,
806806
pub destination_type: BindingDestinationType,
807807
pub routing_key: String,
808-
#[cfg_attr(feature = "tabled", tabled(display_with = "display_arg_table"))]
808+
#[cfg_attr(feature = "tabled", tabled(display = "display_arg_table"))]
809809
pub arguments: XArguments,
810-
#[cfg_attr(feature = "tabled", tabled(display_with = "display_option"))]
810+
#[cfg_attr(feature = "tabled", tabled(display = "display_option"))]
811811
pub properties_key: Option<String>,
812812
}
813813

@@ -1111,31 +1111,31 @@ pub struct QueueTotals {
11111111
pub struct MessageStats {
11121112
/// Consumer delivery rate plus polling (via 'basic.get') rate
11131113
#[serde(rename = "deliver_get_details")]
1114-
#[cfg_attr(feature = "tabled", tabled(display_with = "display_option"))]
1114+
#[cfg_attr(feature = "tabled", tabled(display = "display_option"))]
11151115
pub delivery_details: Option<Rate>,
11161116
#[serde(rename = "publish_details")]
1117-
#[cfg_attr(feature = "tabled", tabled(display_with = "display_option"))]
1117+
#[cfg_attr(feature = "tabled", tabled(display = "display_option"))]
11181118
pub publishing_details: Option<Rate>,
11191119

11201120
#[serde(rename = "deliver_no_ack_details")]
1121-
#[cfg_attr(feature = "tabled", tabled(display_with = "display_option"))]
1121+
#[cfg_attr(feature = "tabled", tabled(display = "display_option"))]
11221122
pub delivery_with_automatic_acknowledgement_details: Option<Rate>,
11231123
#[serde(rename = "redeliver_details")]
1124-
#[cfg_attr(feature = "tabled", tabled(display_with = "display_option"))]
1124+
#[cfg_attr(feature = "tabled", tabled(display = "display_option"))]
11251125
pub redelivery_details: Option<Rate>,
11261126

11271127
#[serde(rename = "confirm_details")]
1128-
#[cfg_attr(feature = "tabled", tabled(display_with = "display_option"))]
1128+
#[cfg_attr(feature = "tabled", tabled(display = "display_option"))]
11291129
pub publisher_confirmation_details: Option<Rate>,
11301130
#[serde(rename = "ack_details")]
1131-
#[cfg_attr(feature = "tabled", tabled(display_with = "display_option"))]
1131+
#[cfg_attr(feature = "tabled", tabled(display = "display_option"))]
11321132
pub consumer_acknowledgement_details: Option<Rate>,
11331133

11341134
#[serde(rename = "drop_unroutable_details")]
1135-
#[cfg_attr(feature = "tabled", tabled(display_with = "display_option"))]
1135+
#[cfg_attr(feature = "tabled", tabled(display = "display_option"))]
11361136
pub unroutable_dropped_message_details: Option<Rate>,
11371137
#[serde(rename = "return_unroutable_details")]
1138-
#[cfg_attr(feature = "tabled", tabled(display_with = "display_option"))]
1138+
#[cfg_attr(feature = "tabled", tabled(display = "display_option"))]
11391139
pub unroutable_returned_message_details: Option<Rate>,
11401140
}
11411141

@@ -1166,9 +1166,9 @@ pub struct Overview {
11661166
pub product_version: String,
11671167

11681168
// these two won't be available in 3.13.x
1169-
#[cfg_attr(feature = "tabled", tabled(display_with = "display_tag_map_option"))]
1169+
#[cfg_attr(feature = "tabled", tabled(display = "display_tag_map_option"))]
11701170
pub cluster_tags: Option<TagMap>,
1171-
#[cfg_attr(feature = "tabled", tabled(display_with = "display_tag_map_option"))]
1171+
#[cfg_attr(feature = "tabled", tabled(display = "display_tag_map_option"))]
11721172
pub node_tags: Option<TagMap>,
11731173

11741174
pub statistics_db_event_queue: u64,
@@ -1600,24 +1600,24 @@ pub struct Shovel {
16001600
pub state: ShovelState,
16011601

16021602
#[serde(rename = "src_uri")]
1603-
#[cfg_attr(feature = "tabled", tabled(display_with = "display_option"))]
1603+
#[cfg_attr(feature = "tabled", tabled(display = "display_option"))]
16041604
pub source_uri: Option<String>,
16051605
#[serde(rename = "dest_uri")]
1606-
#[cfg_attr(feature = "tabled", tabled(display_with = "display_option"))]
1606+
#[cfg_attr(feature = "tabled", tabled(display = "display_option"))]
16071607
pub destination_uri: Option<String>,
16081608
#[serde(rename = "src_queue")]
1609-
#[cfg_attr(feature = "tabled", tabled(display_with = "display_option"))]
1609+
#[cfg_attr(feature = "tabled", tabled(display = "display_option"))]
16101610
pub source: Option<String>,
16111611
#[serde(rename = "dest_queue")]
1612-
#[cfg_attr(feature = "tabled", tabled(display_with = "display_option"))]
1612+
#[cfg_attr(feature = "tabled", tabled(display = "display_option"))]
16131613
pub destination: Option<String>,
16141614

16151615
#[serde(rename = "src_protocol")]
1616-
#[cfg_attr(feature = "tabled", tabled(display_with = "display_option"))]
1616+
#[cfg_attr(feature = "tabled", tabled(display = "display_option"))]
16171617
pub source_protocol: Option<MessagingProtocol>,
16181618

16191619
#[serde(rename = "dest_protocol")]
1620-
#[cfg_attr(feature = "tabled", tabled(display_with = "display_option"))]
1620+
#[cfg_attr(feature = "tabled", tabled(display = "display_option"))]
16211621
pub destination_protocol: Option<MessagingProtocol>,
16221622
}
16231623

@@ -1630,17 +1630,17 @@ pub struct SchemaDefinitionSyncStatus {
16301630
pub state: SchemaDefinitionSyncState,
16311631
pub upstream_username: String,
16321632
pub upstream_endpoints: HostnamePortPairs,
1633-
#[cfg_attr(feature = "tabled", tabled(display_with = "display_option"))]
1633+
#[cfg_attr(feature = "tabled", tabled(display = "display_option"))]
16341634
#[serde(default)]
16351635
pub last_sync_duration: Option<u32>,
1636-
#[cfg_attr(feature = "tabled", tabled(display_with = "display_option"))]
1636+
#[cfg_attr(feature = "tabled", tabled(display = "display_option"))]
16371637
#[serde(
16381638
default,
16391639
rename = "last_connection_completion_stamp",
16401640
with = "time::serde::timestamp::option"
16411641
)]
16421642
pub last_connection_completion_timestamp: Option<OffsetDateTime>,
1643-
#[cfg_attr(feature = "tabled", tabled(display_with = "display_option"))]
1643+
#[cfg_attr(feature = "tabled", tabled(display = "display_option"))]
16441644
#[serde(
16451645
default,
16461646
rename = "last_sync_request_stamp",
@@ -1789,15 +1789,12 @@ pub struct WarmStandbyReplicationInVirtualHost {
17891789
pub state: WarmStandbyReplicationState,
17901790
#[cfg_attr(
17911791
feature = "tabled",
1792-
tabled(display_with = "display_option", rename = "Upstream endpoints")
1792+
tabled(display = "display_option", rename = "Upstream endpoints")
17931793
)]
17941794
pub upstream_endpoints: Option<HostnamePortPairs>,
17951795
#[cfg_attr(
17961796
feature = "tabled",
1797-
tabled(
1798-
rename = "Upstream connection username",
1799-
display_with = "display_option"
1800-
)
1797+
tabled(rename = "Upstream connection username", display = "display_option")
18011798
)]
18021799
pub upstream_username: Option<String>,
18031800
}

0 commit comments

Comments
 (0)