Skip to main content

nominal_api/conjure/objects/api/ids/
workspace_id.rs

1/// Unique identifier for an Workspace. These are unique within an organization.
2/// The workspace ID must be lower case alphanumeric characters, optionally separated by hyphens.
3#[derive(
4    Debug,
5    Clone,
6    conjure_object::serde::Deserialize,
7    conjure_object::serde::Serialize,
8    PartialEq,
9    Eq,
10    PartialOrd,
11    Ord,
12    Hash,
13    Default
14)]
15#[serde(crate = "conjure_object::serde", transparent)]
16pub struct WorkspaceId(pub String);
17impl std::fmt::Display for WorkspaceId {
18    fn fmt(&self, fmt: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
19        std::fmt::Display::fmt(&self.0, fmt)
20    }
21}
22impl conjure_object::Plain for WorkspaceId {
23    fn fmt(&self, fmt: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
24        conjure_object::Plain::fmt(&self.0, fmt)
25    }
26}
27impl conjure_object::FromPlain for WorkspaceId {
28    type Err = <String as conjure_object::FromPlain>::Err;
29    #[inline]
30    fn from_plain(s: &str) -> Result<WorkspaceId, Self::Err> {
31        conjure_object::FromPlain::from_plain(s).map(WorkspaceId)
32    }
33}
34impl std::convert::From<String> for WorkspaceId {
35    #[inline]
36    fn from(v: String) -> Self {
37        WorkspaceId(std::convert::From::from(v))
38    }
39}
40impl std::ops::Deref for WorkspaceId {
41    type Target = String;
42    #[inline]
43    fn deref(&self) -> &String {
44        &self.0
45    }
46}
47impl std::ops::DerefMut for WorkspaceId {
48    #[inline]
49    fn deref_mut(&mut self) -> &mut String {
50        &mut self.0
51    }
52}
53impl std::convert::AsRef<String> for WorkspaceId {
54    #[inline]
55    fn as_ref(&self) -> &String {
56        &self.0
57    }
58}