1 |
use std::{convert::Infallible, fmt::Display, str::FromStr};
|
2 |
|
3 |
use anyhow::Error;
|
4 |
use giterated_models::object::GiteratedObject;
|
5 |
use serde::{Deserialize, Serialize};
|
6 |
|
7 |
#[derive(Clone, Debug, Serialize, Deserialize)]
|
8 |
#[serde(transparent)]
|
9 |
#[repr(transparent)]
|
10 |
pub struct NetworkAnyObject(pub String);
|
11 |
|
12 |
impl GiteratedObject for NetworkAnyObject {
|
13 |
fn object_name() -> &'static str {
|
14 |
"network_object"
|
15 |
}
|
16 |
|
17 |
fn from_object_str(object_str: &str) -> Result<Self, Error> {
|
18 |
Ok(Self(object_str.to_string()))
|
19 |
}
|
20 |
|
21 |
fn home_uri(&self) -> String {
|
22 |
todo!()
|
23 |
}
|
24 |
}
|
25 |
|
26 |
impl Display for NetworkAnyObject {
|
27 |
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
28 |
f.write_str(&self.0)
|
29 |
}
|
30 |
}
|
31 |
|
32 |
impl FromStr for NetworkAnyObject {
|
33 |
type Err = Infallible;
|
34 |
|
35 |
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
36 |
Ok(Self(s.to_owned()))
|
37 |
}
|
38 |
}
|
39 |
|