move into submodule

This commit is contained in:
OMGeeky
2024-02-18 11:33:34 +01:00
parent f08c9937e4
commit 8a8b638bfb
2 changed files with 30 additions and 24 deletions

View File

@@ -1,24 +1 @@
pub mod drive_id {
use lazy_static::lazy_static;
use serde::{Deserialize, Serialize};
lazy_static! {
pub static ref ROOT_ID: DriveId = DriveId(String::from("root"));
}
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub struct DriveId(pub String);
impl<T> From<T> for DriveId
where
T: Into<String>,
{
fn from(s: T) -> Self {
DriveId(s.into())
}
}
impl AsRef<str> for DriveId {
fn as_ref(&self) -> &str {
&self.0
}
}
}
pub mod drive_id;

View File

@@ -0,0 +1,29 @@
use lazy_static::lazy_static;
use serde::{Deserialize, Serialize};
use std::fmt::{Display, Formatter};
lazy_static! {
pub static ref ROOT_ID: DriveId = DriveId(String::from("root"));
}
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub struct DriveId(pub String);
impl<T> From<T> for DriveId
where
T: Into<String>,
{
fn from(s: T) -> Self {
DriveId(s.into())
}
}
impl AsRef<str> for DriveId {
fn as_ref(&self) -> &str {
&self.0
}
}
impl Display for DriveId {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
write!(f, "[{}]", self.0)
}
}