mirror of
https://github.com/EasyTier/EasyTier.git
synced 2026-10-16 01:26:14 -08:00
move hostname function to utils
This commit is contained in:
1 parent
11626d8082
commit
524c8d9987
3 files changed
+11
-14
No files matched your search
@@ -23,6 +23,13 @@ pub fn weak_upgrade<T>(weak: &Weak<T>) -> anyhow::Result<Arc<T>> {
|
||||
.ok_or_else(|| anyhow::anyhow!("{} not available", std::any::type_name::<T>()))
|
||||
}
|
||||
|
||||
pub fn hostname() -> String {
|
||||
hostname::get()
|
||||
.unwrap_or_else(|_| "localhost".into())
|
||||
.to_string_lossy()
|
||||
.into_owned()
|
||||
}
|
||||
|
||||
pub trait BoxExt: Sized {
|
||||
fn boxed(self) -> Box<Self> {
|
||||
Box::new(self)
|
||||
|
||||
Reference in new issue
Block a user