mirror of
https://github.com/lennart-k/rustical.git
synced 2025-12-14 11:42:25 +00:00
resource: change some type signatures
This commit is contained in:
@@ -110,7 +110,7 @@ pub async fn route_proppatch<R: ResourceService>(
|
||||
}
|
||||
Operation::Remove(_remove_el) => {
|
||||
match <<R::Resource as Resource>::PropName as FromStr>::from_str(&propname) {
|
||||
Ok(prop) => match resource.remove_prop(prop) {
|
||||
Ok(prop) => match resource.remove_prop(&prop) {
|
||||
Ok(()) => {
|
||||
props_ok.push(propname);
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ use std::str::FromStr;
|
||||
use strum::VariantNames;
|
||||
|
||||
pub trait Resource: Clone {
|
||||
type PropName: FromStr + VariantNames + Clone;
|
||||
type PropName: FromStr + VariantNames;
|
||||
type Prop: Serialize + for<'de> Deserialize<'de> + fmt::Debug + InvalidProperty;
|
||||
type Error: ResponseError + From<crate::Error>;
|
||||
|
||||
@@ -30,14 +30,14 @@ pub trait Resource: Clone {
|
||||
&self,
|
||||
rmap: &ResourceMap,
|
||||
user: &User,
|
||||
prop: Self::PropName,
|
||||
prop: &Self::PropName,
|
||||
) -> Result<Self::Prop, Self::Error>;
|
||||
|
||||
fn set_prop(&mut self, _prop: Self::Prop) -> Result<(), crate::Error> {
|
||||
Err(crate::Error::PropReadOnly)
|
||||
}
|
||||
|
||||
fn remove_prop(&mut self, _prop: Self::PropName) -> Result<(), crate::Error> {
|
||||
fn remove_prop(&mut self, _prop: &Self::PropName) -> Result<(), crate::Error> {
|
||||
Err(crate::Error::PropReadOnly)
|
||||
}
|
||||
|
||||
@@ -112,7 +112,7 @@ pub trait Resource: Clone {
|
||||
|
||||
let prop_responses = valid_props
|
||||
.into_iter()
|
||||
.map(|prop| self.get_prop(rmap, user, prop))
|
||||
.map(|prop| self.get_prop(rmap, user, &prop))
|
||||
.collect::<Result<Vec<Self::Prop>, Self::Error>>()?;
|
||||
|
||||
let mut propstats = vec![PropstatWrapper::Normal(PropstatElement {
|
||||
|
||||
Reference in New Issue
Block a user