Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: remove outdated no_std part of zenoh_util #1164

Merged
merged 2 commits into from
Jun 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 3 additions & 4 deletions commons/zenoh-util/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,7 @@ description = "Internal crate for zenoh."
maintenance = { status = "actively-developed" }

[features]
std = []
test = []
default = ["std"]

[dependencies]
async-std = { workspace = true, features = ["default", "unstable"] }
Expand All @@ -45,11 +43,12 @@ home = { workspace = true }
humantime = { workspace = true }
lazy_static = { workspace = true }
libloading = { workspace = true }
tracing = {workspace = true}
tracing-subscriber = {workspace = true}
tracing = { workspace = true }
tracing-subscriber = { workspace = true }
shellexpand = { workspace = true }
zenoh-core = { workspace = true }
zenoh-result = { workspace = true, features = ["default"] }
const_format = { workspace = true }

[target.'cfg(windows)'.dependencies]
winapi = { workspace = true }
Expand Down
59 changes: 44 additions & 15 deletions commons/zenoh-util/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,54 @@
//! This crate is intended for Zenoh's internal use.
//!
//! [Click here for Zenoh's documentation](../zenoh/index.html)
#![cfg_attr(not(feature = "std"), no_std)]
extern crate alloc;
#[cfg_attr(feature = "std", macro_use)]
extern crate lazy_static;
use lazy_static::lazy_static;

pub mod ffi;
mod lib_loader;
pub mod net;
pub mod time_range;

pub use lib_loader::*;
pub mod timer;
pub use timer::*;
pub mod log;
pub use log::*;

/// The "ZENOH_HOME" environement variable name
pub const ZENOH_HOME_ENV_VAR: &str = "ZENOH_HOME";

const DEFAULT_ZENOH_HOME_DIRNAME: &str = ".zenoh";

/// Return the path to the ${ZENOH_HOME} directory (~/.zenoh by default).
pub fn zenoh_home() -> &'static std::path::Path {
use std::path::PathBuf;
lazy_static! {
static ref ROOT: PathBuf = {
if let Some(dir) = std::env::var_os(ZENOH_HOME_ENV_VAR) {
PathBuf::from(dir)
} else {
match home::home_dir() {
Some(mut dir) => {
dir.push(DEFAULT_ZENOH_HOME_DIRNAME);
dir
}
None => PathBuf::from(DEFAULT_ZENOH_HOME_DIRNAME),
}
}
};
}
ROOT.as_path()
}

#[doc(hidden)]
pub use const_format::concatcp as __concatcp;
#[macro_export]
macro_rules! concat_enabled_features {
(prefix = $prefix:literal, features = [$($feature:literal),*]) => {
(prefix = $prefix:literal, features = [$($feature:literal),* $(,)?]) => {
{
use const_format::concatcp;
concatcp!("" $(,
if cfg!(feature = $feature) { concatcp!(" ", concatcp!($prefix, "/", $feature)) } else { "" }
)*)
$crate::__concatcp!($(
if cfg!(feature = $feature) { $crate::__concatcp!(" ", $prefix, "/", $feature) } else { "" }
),*)
}
};
}

#[cfg(feature = "std")]
mod std_only;

#[cfg(feature = "std")]
pub use std_only::*;
File renamed without changes.
35 changes: 0 additions & 35 deletions commons/zenoh-util/src/std_only/mod.rs

This file was deleted.

5 changes: 2 additions & 3 deletions plugins/zenoh-plugin-trait/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,10 @@ name = "zenoh_plugin_trait"

[dependencies]
libloading = { workspace = true }
tracing = {workspace = true}
tracing = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
zenoh-macros = { workspace = true }
zenoh-result = { workspace = true }
zenoh-util = { workspace = true }
zenoh-keyexpr = { workspace = true, features = ["internal", "unstable"] }
const_format = { workspace = true }
zenoh-keyexpr = { workspace = true, features = ["internal", "unstable"] }
1 change: 0 additions & 1 deletion zenoh/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ tokio-util = { workspace = true }
ahash = { workspace = true }
async-trait = { workspace = true }
base64 = { workspace = true }
const_format = { workspace = true }
event-listener = { workspace = true }
flume = { workspace = true }
form_urlencoded = { workspace = true }
Expand Down
Loading