1use std::fmt::Display;
2
3use abi_stable::{std_types::RString, StableAbi};
4use serde::{Deserialize, Serialize};
5
6#[repr(C)]
7#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize, StableAbi)]
8pub struct AudioInputId(RString);
9impl AudioInputId {
10 pub fn new_from(id: RString) -> Self {
11 Self(id)
12 }
13}
14impl Default for AudioInputId {
15 fn default() -> Self {
16 Self(uuid::Uuid::new_v4().to_string().into())
17 }
18}
19impl Display for AudioInputId {
20 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
21 write!(f, "{}", self.0)
22 }
23}
24
25#[repr(C)]
26#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize, StableAbi)]
27pub struct AudioOutputId(RString);
28impl AudioOutputId {
29 pub fn new_from(id: RString) -> Self {
30 Self(id)
31 }
32}
33impl Default for AudioOutputId {
34 fn default() -> Self {
35 Self(uuid::Uuid::new_v4().to_string().into())
36 }
37}
38impl Display for AudioOutputId {
39 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
40 write!(f, "{}", self.0)
41 }
42}
43
44#[repr(C)]
45#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize, StableAbi)]
46pub struct VideoInputId(RString);
47impl VideoInputId {
48 pub fn new_from(id: RString) -> Self {
49 Self(id)
50 }
51}
52impl Default for VideoInputId {
53 fn default() -> Self {
54 Self(uuid::Uuid::new_v4().to_string().into())
55 }
56}
57impl Display for VideoInputId {
58 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
59 write!(f, "{}", self.0)
60 }
61}
62
63#[repr(C)]
64#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize, StableAbi)]
65pub struct VideoOutputId(RString);
66impl VideoOutputId {
67 pub fn new_from(id: RString) -> Self {
68 Self(id)
69 }
70}
71impl Default for VideoOutputId {
72 fn default() -> Self {
73 Self(uuid::Uuid::new_v4().to_string().into())
74 }
75}
76impl Display for VideoOutputId {
77 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
78 write!(f, "{}", self.0)
79 }
80}