mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-26 10:21:52 +00:00
* refactor networking and account * add interfaces from manifest automatically * use nistp256 to satisfy firefox * use ed25519 if available * fix ip signing * fix SQL error * update prettytable to fix segfault * fix migration * fix migration * bump welcome-ack * add redirect if connecting to https over http * misc rebase fixes * fix compression * bump rustc version
43 lines
1005 B
Rust
43 lines
1005 B
Rust
use std::path::Path;
|
|
|
|
use serde::{Deserialize, Deserializer, Serialize};
|
|
|
|
use crate::Id;
|
|
|
|
#[derive(Clone, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize)]
|
|
pub struct InterfaceId(Id);
|
|
impl From<Id> for InterfaceId {
|
|
fn from(id: Id) -> Self {
|
|
Self(id)
|
|
}
|
|
}
|
|
impl std::fmt::Display for InterfaceId {
|
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
|
write!(f, "{}", &self.0)
|
|
}
|
|
}
|
|
impl std::ops::Deref for InterfaceId {
|
|
type Target = String;
|
|
fn deref(&self) -> &Self::Target {
|
|
&*self.0
|
|
}
|
|
}
|
|
impl AsRef<str> for InterfaceId {
|
|
fn as_ref(&self) -> &str {
|
|
self.0.as_ref()
|
|
}
|
|
}
|
|
impl<'de> Deserialize<'de> for InterfaceId {
|
|
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
|
|
where
|
|
D: Deserializer<'de>,
|
|
{
|
|
Ok(InterfaceId(Deserialize::deserialize(deserializer)?))
|
|
}
|
|
}
|
|
impl AsRef<Path> for InterfaceId {
|
|
fn as_ref(&self) -> &Path {
|
|
self.0.as_ref().as_ref()
|
|
}
|
|
}
|