ResourceName trait: Use Cow instead of String

This commit is contained in:
Lennart
2025-12-31 10:57:12 +01:00
parent 9c3972e21c
commit 578ddde36d
7 changed files with 23 additions and 13 deletions

View File

@@ -17,6 +17,7 @@ use rustical_store::auth::Principal;
use rustical_xml::{EnumVariants, PropName};
use rustical_xml::{XmlDeserialize, XmlSerialize};
use serde::Deserialize;
use std::borrow::Cow;
#[derive(XmlDeserialize, XmlSerialize, PartialEq, Eq, Clone, EnumVariants, PropName)]
#[xml(unit_variants_ident = "CalendarPropName")]
@@ -72,8 +73,8 @@ pub struct CalendarResource {
}
impl ResourceName for CalendarResource {
fn get_name(&self) -> String {
self.cal.id.clone()
fn get_name(&self) -> Cow<'_, str> {
Cow::from(&self.cal.id)
}
}