Skip to content

Commit 9136516

Browse files
committed
Don't reexport tedge_config::tedge_toml::models::*
Exporting all these items globally under tedge_config clutters the suggestion list. Instead make them available under `tedge_config::models`. Signed-off-by: Marcel Guzik <marcel.guzik@cumulocity.com>
1 parent bfda95e commit 9136516

File tree

37 files changed

+83
-78
lines changed

37 files changed

+83
-78
lines changed

crates/common/tedge_config/src/lib.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
mod sudo;
2-
pub mod tedge_toml;
32
pub use sudo::SudoCommandBuilder;
43
pub mod cli;
54
mod system_toml;
6-
75
pub use self::system_toml::*;
6+
7+
pub mod tedge_toml;
88
pub use self::tedge_toml::error::*;
9-
pub use self::tedge_toml::models::*;
109
pub use self::tedge_toml::tedge_config::*;
1110
pub use self::tedge_toml::tedge_config_location::*;
11+
pub use tedge_toml::models;
12+
1213
pub use camino::Utf8Path as Path;
1314
pub use camino::Utf8PathBuf as PathBuf;
1415
pub use certificate::CertificateError;

crates/common/tedge_config/src/tedge_toml/models/host_port.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
use crate::ConnectUrl;
2-
use crate::Port;
1+
use super::ConnectUrl;
2+
use super::Port;
33
use serde::Deserialize;
44
use serde::Serialize;
55
use std::fmt;
@@ -19,7 +19,7 @@ use url::Host;
1919
/// # Examples
2020
///
2121
/// ```
22-
/// # use tedge_config::{HostPort, Port, HTTPS_PORT};
22+
/// # use tedge_config::models::{HostPort, Port, HTTPS_PORT};
2323
///
2424
/// // use a fallback port if not present in string
2525
/// let http = HostPort::<HTTPS_PORT>::try_from("my-tenant.cumulocity.com".to_string()).unwrap();
@@ -142,8 +142,9 @@ pub enum ParseHostPortError {
142142
#[cfg(test)]
143143
mod tests {
144144
use super::*;
145-
use crate::HTTPS_PORT;
146-
use crate::MQTT_TLS_PORT;
145+
146+
use super::super::HTTPS_PORT;
147+
use super::super::MQTT_TLS_PORT;
147148
use test_case::test_case;
148149

149150
#[test_case(HostPort::<HTTPS_PORT>::try_from("test.com").unwrap(), "test.com:443")]

crates/common/tedge_config/src/tedge_toml/models/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ pub use self::port::*;
3333
pub use self::seconds::*;
3434
pub use self::templates_set::*;
3535
pub use tedge_utils::timestamp;
36+
pub use tedge_utils::timestamp::TimeFormat;
3637
pub use topic_prefix::TopicPrefix;
3738

3839
#[derive(

crates/common/tedge_config/src/tedge_toml/tedge_config.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,21 @@ use version::TEdgeTomlVersion;
44
mod append_remove;
55
pub use append_remove::AppendRemoveItem;
66

7+
use super::models::auth_method::AuthMethod;
78
use super::models::timestamp::TimeFormat;
8-
use crate::auth_method::AuthMethod;
9-
use crate::AptConfig;
10-
use crate::AutoFlag;
11-
use crate::AutoLogUpload;
12-
use crate::ConnectUrl;
13-
use crate::HostPort;
14-
use crate::MqttPayloadLimit;
15-
use crate::SecondsOrHumanTime;
16-
use crate::SoftwareManagementApiFlag;
17-
use crate::TEdgeConfigLocation;
18-
use crate::TemplatesSet;
19-
use crate::TopicPrefix;
20-
use crate::HTTPS_PORT;
21-
use crate::MQTT_TLS_PORT;
9+
use super::models::AptConfig;
10+
use super::models::AutoFlag;
11+
use super::models::AutoLogUpload;
12+
use super::models::ConnectUrl;
13+
use super::models::HostPort;
14+
use super::models::MqttPayloadLimit;
15+
use super::models::SecondsOrHumanTime;
16+
use super::models::SoftwareManagementApiFlag;
17+
use super::models::TemplatesSet;
18+
use super::models::TopicPrefix;
19+
use super::models::HTTPS_PORT;
20+
use super::models::MQTT_TLS_PORT;
21+
use super::tedge_config_location::TEdgeConfigLocation;
2222
use anyhow::anyhow;
2323
use anyhow::Context;
2424
use camino::Utf8Path;

crates/core/c8y_api/src/http_proxy.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ use reqwest::header::InvalidHeaderValue;
1414
use reqwest::Url;
1515
use std::path::PathBuf;
1616
use std::time::Duration;
17-
use tedge_config::auth_method::AuthType;
17+
use tedge_config::models::auth_method::AuthType;
18+
use tedge_config::models::TopicPrefix;
1819
use tedge_config::CertificateError;
1920
use tedge_config::ConfigNotSet;
2021
use tedge_config::MultiError;
2122
use tedge_config::ReadError;
2223
use tedge_config::TEdgeConfig;
23-
use tedge_config::TopicPrefix;
2424
use tracing::debug;
2525
use tracing::error;
2626
use tracing::info;

crates/core/c8y_api/src/json_c8y_deserializer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use tedge_api::mqtt_topics::EntityTopicId;
1212
use tedge_api::SoftwareModule;
1313
use tedge_api::SoftwareModuleUpdate;
1414
use tedge_api::SoftwareUpdateCommand;
15-
use tedge_config::TopicPrefix;
15+
use tedge_config::models::TopicPrefix;
1616
use time::OffsetDateTime;
1717

1818
pub struct C8yDeviceControlTopic;

crates/core/c8y_api/src/smartrest/inventory.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use crate::smartrest::topic::publish_topic_from_parent;
1313
use crate::smartrest::topic::C8yTopic;
1414
use mqtt_channel::MqttMessage;
1515
use std::time::Duration;
16-
use tedge_config::TopicPrefix;
16+
use tedge_config::models::TopicPrefix;
1717

1818
use super::message_ids::CHILD_DEVICE_CREATION;
1919
use super::message_ids::SERVICE_CREATION;

crates/core/c8y_api/src/smartrest/topic.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use mqtt_channel::Topic;
44
use mqtt_channel::TopicFilter;
55
use tedge_api::entity::EntityExternalId;
66
use tedge_api::entity::EntityType;
7-
use tedge_config::TopicPrefix;
7+
use tedge_config::models::TopicPrefix;
88

99
const SMARTREST_PUBLISH_TOPIC: &str = "s/us";
1010
const SMARTREST_SUBSCRIBE_TOPIC: &str = "s/ds";

crates/core/c8y_api/src/utils.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ pub mod child_device {
22
use crate::smartrest::message_ids::CHILD_DEVICE_CREATION;
33
use crate::smartrest::topic::C8yTopic;
44
use mqtt_channel::MqttMessage;
5-
use tedge_config::TopicPrefix;
5+
use tedge_config::models::TopicPrefix;
66

77
pub fn new_child_device_message(child_id: &str, prefix: &TopicPrefix) -> MqttMessage {
88
MqttMessage::new(

crates/core/tedge/src/bridge/aws.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ use std::time::Duration;
66
use tedge_api::mqtt_topics::Channel;
77
use tedge_api::mqtt_topics::EntityTopicId;
88
use tedge_api::mqtt_topics::MqttSchema;
9-
use tedge_config::HostPort;
9+
use tedge_config::models::HostPort;
10+
use tedge_config::models::TopicPrefix;
11+
use tedge_config::models::MQTT_TLS_PORT;
1012
use tedge_config::ProfileName;
11-
use tedge_config::TopicPrefix;
12-
use tedge_config::MQTT_TLS_PORT;
1313

1414
#[derive(Debug)]
1515
pub struct BridgeConfigAwsParams {

0 commit comments

Comments
 (0)