m/cup
1
0
mirror of https://github.com/sergi0g/cup.git synced 2025-11-16 17:13:46 -05:00

Remove some clone usage

This commit is contained in:
Sergio
2024-12-04 19:44:04 +02:00
parent d85fadfb39
commit 36a3a13c04
2 changed files with 13 additions and 12 deletions

View File

@@ -1,26 +1,26 @@
use bollard::secret::{ImageInspect, ImageSummary};
pub trait InspectData {
fn tags(&self) -> Option<Vec<String>>;
fn digests(&self) -> Option<Vec<String>>;
fn tags(&self) -> Option<&Vec<String>>;
fn digests(&self) -> Option<&Vec<String>>;
}
impl InspectData for ImageInspect {
fn tags(&self) -> Option<Vec<String>> {
self.repo_tags.clone()
fn tags(&self) -> Option<&Vec<String>> {
self.repo_tags.as_ref()
}
fn digests(&self) -> Option<Vec<String>> {
self.repo_digests.clone()
fn digests(&self) -> Option<&Vec<String>> {
self.repo_digests.as_ref()
}
}
impl InspectData for ImageSummary {
fn tags(&self) -> Option<Vec<String>> {
Some(self.repo_tags.clone())
fn tags(&self) -> Option<&Vec<String>> {
Some(&self.repo_tags)
}
fn digests(&self) -> Option<Vec<String>> {
Some(self.repo_digests.clone())
fn digests(&self) -> Option<&Vec<String>> {
Some(&self.repo_digests)
}
}