pub struct Network {
pub driver: Option<Driver>,
pub driver_opts: IndexMap<MapKey, StringOrNumber>,
pub attachable: bool,
pub enable_ipv6: bool,
pub ipam: Option<Ipam>,
pub internal: bool,
pub labels: ListOrMap,
pub name: Option<String>,
pub extensions: Extensions,
}
Expand description
A named network which allows for Service
s to communicate with each other.
Fields§
§driver: Option<Driver>
Which driver to use for this network.
driver_opts: IndexMap<MapKey, StringOrNumber>
Driver-dependent options.
attachable: bool
Whether externally managed containers may attach to this network, in addition to
Service
s.
enable_ipv6: bool
Whether to enable IPv6 networking.
ipam: Option<Ipam>
Custom IPAM configuration.
internal: bool
Whether to isolate this network from external connectivity.
labels: ListOrMap
Add metadata to the network.
name: Option<String>
Custom name for the network.
extensions: Extensions
Extension values, which are (de)serialized via flattening.
Implementations§
Source§impl Network
impl Network
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Returns true
if all fields are None
, false
, or empty.
The ipam
field counts as empty if it is None
or empty.
§Examples
use compose_spec::{Network, network::Ipam};
let mut network = Network::default();
assert!(network.is_empty());
network.ipam = Some(Ipam::default());
assert!(network.is_empty());
network.ipam = Some(Ipam {
driver: Some("driver".to_owned()),
..Ipam::default()
});
assert!(!network.is_empty());
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Network
impl<'de> Deserialize<'de> for Network
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for Network
Auto Trait Implementations§
impl Freeze for Network
impl RefUnwindSafe for Network
impl Send for Network
impl Sync for Network
impl Unpin for Network
impl UnwindSafe for Network
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more