use std::ops::{Deref, DerefMut};
use disposition_model_common::{Id, IdInvalidFmt};
use serde::{Deserialize, Serialize};
#[cfg_attr(feature = "openapi", derive(utoipa::ToSchema))]
#[derive(Clone, Debug, Hash, PartialEq, Eq, Deserialize, Serialize)]
pub struct EdgeGroupId(Id);
impl EdgeGroupId {
pub fn new(id: &'static str) -> Result<Self, IdInvalidFmt<'static>> {
Id::new(id).map(EdgeGroupId)
}
pub fn into_inner(self) -> Id {
self.0
}
}
impl From<Id> for EdgeGroupId {
fn from(id: Id) -> Self {
EdgeGroupId(id)
}
}
impl Deref for EdgeGroupId {
type Target = Id;
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl DerefMut for EdgeGroupId {
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.0
}
}