mirror of
https://git.proxmox.com/git/proxmox
synced 2025-08-03 10:14:40 +00:00
rest-server: more convenient alias-list for ApiConfig
To the existing `.alias(item)`, add a `.aliases(into-item-iter)` similar to how `Extend` works. Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
parent
310310c650
commit
2f2f5cfcd8
@ -146,6 +146,18 @@ impl ApiConfig {
|
||||
self
|
||||
}
|
||||
|
||||
/// Register multiple path aliases. See `[ApiConfig::alias()]`.
|
||||
pub fn aliases<I, S, P>(mut self, aliases: I) -> Self
|
||||
where
|
||||
I: IntoIterator<Item = (S, P)>,
|
||||
S: Into<String>,
|
||||
P: Into<PathBuf>,
|
||||
{
|
||||
self.aliases
|
||||
.extend(aliases.into_iter().map(|(s, p)| (s.into(), p.into())));
|
||||
self
|
||||
}
|
||||
|
||||
pub(crate) fn env_type(&self) -> RpcEnvironmentType {
|
||||
self.env_type
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user