various: add Display impls for domain enums; improve contextual errors
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: Ia16e7e34cda6ae3e12590ea1ea9268486a6a6964
This commit is contained in:
parent
fe165f9d4b
commit
cd63eeccff
6 changed files with 143 additions and 77 deletions
|
|
@ -181,6 +181,23 @@ pub enum CustomFieldType {
|
|||
Boolean,
|
||||
}
|
||||
|
||||
impl CustomFieldType {
|
||||
pub fn as_str(&self) -> &'static str {
|
||||
match self {
|
||||
Self::Text => "text",
|
||||
Self::Number => "number",
|
||||
Self::Date => "date",
|
||||
Self::Boolean => "boolean",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl std::fmt::Display for CustomFieldType {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
f.write_str(self.as_str())
|
||||
}
|
||||
}
|
||||
|
||||
/// A tag that can be applied to media items.
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct Tag {
|
||||
|
|
@ -210,6 +227,21 @@ pub enum CollectionKind {
|
|||
Virtual,
|
||||
}
|
||||
|
||||
impl CollectionKind {
|
||||
pub fn as_str(&self) -> &'static str {
|
||||
match self {
|
||||
Self::Manual => "manual",
|
||||
Self::Virtual => "virtual",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl std::fmt::Display for CollectionKind {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
f.write_str(self.as_str())
|
||||
}
|
||||
}
|
||||
|
||||
/// A member of a collection with position tracking.
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct CollectionMember {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue