mirror of
https://git.proxmox.com/git/proxmox
synced 2025-08-05 18:00:26 +00:00
api types: replace PathPatterns with Vec<PathPattern>
PathPatterns is hard to distinguish from PathPattern, so would need to be renamed anyway.. but there isn't really a reason to define a separate API type just for this. Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
This commit is contained in:
parent
85256a6b6c
commit
6e3c5afce5
@ -1,4 +1,4 @@
|
||||
use proxmox_schema::{const_regex, ApiStringFormat, ApiType, ArraySchema, Schema, StringSchema};
|
||||
use proxmox_schema::{const_regex, ApiStringFormat, ApiType, Schema, StringSchema};
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
@ -13,12 +13,6 @@ pub const PATH_PATTERN_SCHEMA: Schema =
|
||||
.format(&PATH_PATTERN_FORMAT)
|
||||
.schema();
|
||||
|
||||
pub const PATH_PATTERN_LIST_SCHEMA: Schema = ArraySchema::new(
|
||||
"List of paths or match patterns for matching filenames.",
|
||||
&PATH_PATTERN_SCHEMA,
|
||||
)
|
||||
.schema();
|
||||
|
||||
#[derive(Default, Deserialize, Serialize)]
|
||||
/// Path or path pattern for filename matching
|
||||
pub struct PathPattern {
|
||||
@ -34,22 +28,3 @@ impl AsRef<[u8]> for PathPattern {
|
||||
self.pattern.as_bytes()
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Default, Deserialize, Serialize)]
|
||||
/// Array of paths and/or path patterns for filename matching
|
||||
pub struct PathPatterns {
|
||||
patterns: Vec<PathPattern>,
|
||||
}
|
||||
|
||||
impl ApiType for PathPatterns {
|
||||
const API_SCHEMA: Schema = PATH_PATTERN_LIST_SCHEMA;
|
||||
}
|
||||
|
||||
impl IntoIterator for PathPatterns {
|
||||
type Item = PathPattern;
|
||||
type IntoIter = std::vec::IntoIter<PathPattern>;
|
||||
|
||||
fn into_iter(self) -> Self::IntoIter {
|
||||
self.patterns.into_iter()
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user