pub struct Networks<'a> { /* private fields */ }Expand description
Network operations manager.
Implementations§
Source§impl<'a> Networks<'a>
impl<'a> Networks<'a>
Sourcepub async fn create(
&self,
name: impl Into<String>,
driver: impl Into<String>,
) -> Result<String>
pub async fn create( &self, name: impl Into<String>, driver: impl Into<String>, ) -> Result<String>
Create a new network.
§Example
use lmrc_docker::DockerClient;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = DockerClient::new()?;
let network_id = client.networks()
.create("my-network", "bridge")
.await?;
println!("Created network: {}", network_id);
Ok(())
}Sourcepub async fn list(&self) -> Result<Vec<Network>>
pub async fn list(&self) -> Result<Vec<Network>>
List all networks.
§Example
use lmrc_docker::DockerClient;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = DockerClient::new()?;
let networks = client.networks().list().await?;
for network in networks {
println!("{}: {:?}", network.id.unwrap(), network.name);
}
Ok(())
}Sourcepub fn get(&self, name_or_id: impl Into<String>) -> NetworkRef<'a>
pub fn get(&self, name_or_id: impl Into<String>) -> NetworkRef<'a>
Get a reference to a specific network.
Sourcepub async fn prune(&self) -> Result<NetworkPruneResponse>
pub async fn prune(&self) -> Result<NetworkPruneResponse>
Prune unused networks.
Auto Trait Implementations§
impl<'a> Freeze for Networks<'a>
impl<'a> !RefUnwindSafe for Networks<'a>
impl<'a> Send for Networks<'a>
impl<'a> Sync for Networks<'a>
impl<'a> Unpin for Networks<'a>
impl<'a> !UnwindSafe for Networks<'a>
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