Skip to content

Commit a178803

Browse files
committed
Replace compact_str with smol_str throughout the codebase
Signed-off-by: Nicola Bonelli <[email protected]>
1 parent 308d6a2 commit a178803

38 files changed

+226
-278
lines changed

Cargo.lock

Lines changed: 25 additions & 75 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ orion-xds = { path = "orion-xds" }
4343
abort-on-drop = "0.2"
4444
bounded-integer = "0.5.8"
4545
bytes = "1"
46-
compact_str = { version = "0.8.0", features = ["serde"] }
46+
smol_str = { version = "0.3.2", features = ["serde"] }
4747
exponential-backoff = "1.2.0"
4848
futures = "0.3"
4949
http = "1.0"

orion-configuration/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ base64 = "0.22.1"
1313
base64-serde = "0.7.0"
1414
bounded-integer = { version = "0.5.8", features = ["serde", "types"] }
1515
bytes.workspace = true
16+
smol_str.workspace = true
1617
clap = { version = "4.5.46", features = ["derive"] }
17-
compact_str.workspace = true
1818
exponential-backoff.workspace = true
1919
http.workspace = true
2020
http-serde-ext = "1.0.2"

orion-configuration/src/config/bootstrap.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ use std::time::Duration;
2323
use crate::config::{
2424
cluster::Cluster, common::is_default, core::Address, listener::Listener, metrics::StatsSink, secret::Secret,
2525
};
26-
use compact_str::CompactString;
2726
use serde::{Deserialize, Serialize};
27+
use smol_str::SmolStr;
2828

2929
#[derive(Debug, Clone, Serialize, Deserialize, Default, PartialEq)]
3030
pub struct Bootstrap {
@@ -43,15 +43,15 @@ pub struct Bootstrap {
4343
}
4444

4545
impl Bootstrap {
46-
pub fn get_ads_configs(&self) -> &[CompactString] {
46+
pub fn get_ads_configs(&self) -> &[SmolStr] {
4747
self.dynamic_resources.as_ref().map(|dr| dr.grpc_cluster_specifiers.as_slice()).unwrap_or_default()
4848
}
4949
}
5050

5151
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, Default)]
5252
pub struct Node {
53-
pub id: CompactString,
54-
pub cluster_id: CompactString,
53+
pub id: SmolStr,
54+
pub cluster_id: SmolStr,
5555
}
5656

5757
impl Node {
@@ -68,7 +68,7 @@ impl Node {
6868

6969
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
7070
pub struct DynamicResources {
71-
pub grpc_cluster_specifiers: Vec<CompactString>,
71+
pub grpc_cluster_specifiers: Vec<SmolStr>,
7272
}
7373

7474
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
@@ -91,7 +91,6 @@ mod envoy_conversions {
9191
#![allow(deprecated)]
9292
use super::{Admin, Bootstrap, DynamicResources, Node, StaticResources};
9393
use crate::config::{common::*, grpc::Duration, metrics::StatsSink};
94-
use compact_str::CompactString;
9594
use orion_data_plane_api::envoy_data_plane_api::envoy::config::{
9695
bootstrap::v3::{
9796
bootstrap::{DynamicResources as EnvoyDynamicResources, StaticResources as EnvoyStaticResources},
@@ -104,6 +103,7 @@ mod envoy_conversions {
104103
},
105104
metrics::v3::stats_sink::ConfigType,
106105
};
106+
use smol_str::SmolStr;
107107

108108
impl Bootstrap {
109109
pub fn deserialize_from_envoy<R: std::io::Read>(rdr: R) -> Result<Self, GenericError> {
@@ -313,7 +313,7 @@ mod envoy_conversions {
313313
)
314314
.with_node("target_specifier")?;
315315
let cluster_name = required!(cluster_name).with_node("target_specifier")?;
316-
cluster_specifiers.push(CompactString::from(cluster_name))
316+
cluster_specifiers.push(SmolStr::from(cluster_name))
317317
},
318318
EnvoyGrpcTargetSpecifier::GoogleGrpc(_) => {
319319
return Err(GenericError::unsupported_variant("GoogleGrpc"))

0 commit comments

Comments
 (0)