From 7cd30b1bc167eb7b6baf1a893c484f40d84cb5a7 Mon Sep 17 00:00:00 2001 From: Jonas Pommerening Date: Thu, 1 Apr 2021 14:45:56 +0200 Subject: Fix incorrect return type of Networks::list Moved and renamed NetworkInfo nee rep::Network to container::NetworkStats --- src/container.rs | 16 ++++++++++++++-- src/lib.rs | 4 ++-- src/network.rs | 16 ++-------------- 3 files changed, 18 insertions(+), 18 deletions(-) (limited to 'src') diff --git a/src/container.rs b/src/container.rs index 24c41d6..f92811a 100644 --- a/src/container.rs +++ b/src/container.rs @@ -20,7 +20,7 @@ use crate::{ errors::{Error, Result}, exec::{Exec, ExecContainerOptions}, image::Config, - network::{NetworkInfo, NetworkSettings}, + network::NetworkSettings, transport::Payload, tty::{self, Multiplexer as TtyMultiPlexer}, }; @@ -1288,12 +1288,24 @@ pub struct Port { #[derive(Clone, Debug, Serialize, Deserialize)] pub struct Stats { pub read: String, - pub networks: HashMap, + pub networks: HashMap, pub memory_stats: MemoryStats, pub blkio_stats: BlkioStats, pub cpu_stats: CpuStats, } +#[derive(Clone, Debug, Serialize, Deserialize)] +pub struct NetworkStats { + pub rx_dropped: u64, + pub rx_bytes: u64, + pub rx_errors: u64, + pub tx_packets: u64, + pub tx_dropped: u64, + pub rx_packets: u64, + pub tx_errors: u64, + pub tx_bytes: u64, +} + #[derive(Clone, Debug, Serialize, Deserialize)] pub struct MemoryStats { pub max_usage: u64, diff --git a/src/lib.rs b/src/lib.rs index 14c8559..4d60523 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -113,7 +113,7 @@ reexport! { mod rep; container::{ ContainerInfo as Container, ContainerDetails, Mount, State, HostConfig, Port, Stats, - MemoryStats, MemoryStat, CpuStats, CpuUsage, ThrottlingData, BlkioStats, BlkioStat, Change, + MemoryStats, MemoryStat, NetworkStats as Network, CpuStats, CpuUsage, ThrottlingData, BlkioStats, BlkioStat, Change, Top, ContainerCreateInfo, Exit, }; docker::{Version, Info, Event, Actor}; @@ -122,7 +122,7 @@ reexport! { SearchResult, ImageInfo as Image, ImageDetails, Config, History, Status, }; network::{ - NetworkSettings, NetworkEntry, NetworkInfo as Network, Ipam, NetworkDetails, + NetworkSettings, NetworkEntry, Ipam, NetworkDetails, NetworkContainerDetails, NetworkCreateInfo, }; service::{ diff --git a/src/network.rs b/src/network.rs index ff2c83f..6dd4eb3 100644 --- a/src/network.rs +++ b/src/network.rs @@ -36,7 +36,7 @@ impl<'docker> Networks<'docker> { pub async fn list( &self, opts: &NetworkListOptions, - ) -> Result> { + ) -> Result> { let mut path = vec!["/networks".to_owned()]; if let Some(query) = opts.serialize() { path.push(query); @@ -100,7 +100,7 @@ impl<'docker> Network<'docker> { /// Inspects the current docker network instance's details /// /// API Reference: - pub async fn inspect(&self) -> Result { + pub async fn inspect(&self) -> Result { self.docker .get_json(&format!("/networks/{}", self.id)[..]) .await @@ -366,18 +366,6 @@ pub struct EndpointIPAMConfig { pub link_local_ips: Vec, } -#[derive(Clone, Debug, Serialize, Deserialize)] -pub struct NetworkInfo { - pub rx_dropped: u64, - pub rx_bytes: u64, - pub rx_errors: u64, - pub tx_packets: u64, - pub tx_dropped: u64, - pub rx_packets: u64, - pub tx_errors: u64, - pub tx_bytes: u64, -} - #[derive(Clone, Debug, Serialize, Deserialize)] #[serde(rename_all = "PascalCase")] pub struct Ipam { -- cgit v1.2.3