Skip to main content

Docker

Struct Docker 

Source
pub struct Docker { /* private fields */ }
Expand description

Docker container manager

Implementations§

Source§

impl Docker

Source

pub async fn connect() -> Result<Self, DockerError>

Create a new Docker container manager

Source

pub async fn ping(&self) -> Result<(), DockerError>

Ping the Docker daemon

Source

pub fn events(&self) -> impl Stream<Item = Result<EventMessage, DockerError>>

Ping the Docker daemon

Methods from Deref<Target = Client>§

Source

pub async fn list_containers( &self, options: Option<impl Into<ListContainersOptions>>, ) -> Result<Vec<ContainerSummary>, Error>


§List Containers

Returns a list of containers.

§Arguments
§Returns
§Examples
use bollard::container::ListContainersOptions;

use std::collections::HashMap;
use std::default::Default;

let mut filters = HashMap::new();
filters.insert("health", vec!["unhealthy"]);

let options = Some(ListContainersOptions{
    all: true,
    filters,
    ..Default::default()
});

docker.list_containers(options);
Source

pub async fn create_container( &self, options: Option<impl Into<CreateContainerOptions>>, config: impl Into<ContainerCreateBody>, ) -> Result<ContainerCreateResponse, Error>


§Create Container

Prepares a container for a subsequent start operation.

§Arguments
§Returns
§Examples
use bollard::container::{CreateContainerOptions, Config};

use std::default::Default;

let options = Some(CreateContainerOptions{
    name: "my-new-container",
    platform: None,
});

let config = Config {
    image: Some("hello-world"),
    cmd: Some(vec!["/hello"]),
    ..Default::default()
};

docker.create_container(options, config);
Source

pub async fn start_container( &self, container_name: &str, options: Option<impl Into<StartContainerOptions>>, ) -> Result<(), Error>


§Start Container

Starts a container, after preparing it with the Create Container API.

§Arguments
§Returns
  • unit type (), wrapped in a Future.
§Examples
use bollard::container::StartContainerOptions;

docker.start_container("hello-world", None::<StartContainerOptions<String>>);
Source

pub async fn stop_container( &self, container_name: &str, options: Option<impl Into<StopContainerOptions>>, ) -> Result<(), Error>


§Stop Container

Stops a container.

§Arguments
§Returns
  • unit type (), wrapped in a Future.
§Examples
use bollard::container::StopContainerOptions;

let options = Some(StopContainerOptions{
    t: 30,
});

docker.stop_container("hello-world", options);
Source

pub async fn remove_container( &self, container_name: &str, options: Option<impl Into<RemoveContainerOptions>>, ) -> Result<(), Error>


§Remove Container

Remove a container.

§Arguments
§Returns
  • unit type (), wrapped in a Future.
§Examples

use bollard::container::RemoveContainerOptions;

use std::default::Default;

let options = Some(RemoveContainerOptions{
    force: true,
    ..Default::default()
});

docker.remove_container("hello-world", options);
Source

pub fn wait_container( &self, container_name: &str, options: Option<impl Into<WaitContainerOptions>>, ) -> impl Stream<Item = Result<ContainerWaitResponse, Error>>


§Wait Container

Wait for a container to stop. This is a non-blocking operation, the resulting stream will end when the container stops.

§Arguments
§Returns
§Examples

use bollard::container::WaitContainerOptions;

let options = Some(WaitContainerOptions{
    condition: "not-running",
});

docker.wait_container("hello-world", options);
Source

pub async fn attach_container( &self, container_name: &str, options: Option<impl Into<AttachContainerOptions>>, ) -> Result<AttachContainerResults, Error>


§Attach Container

Attach to a container to read its output or send it input. You can attach to the same container multiple times and you can reattach to containers that have been detached.

§Arguments
§Returns
§Examples

use bollard::container::AttachContainerOptions;

let options = Some(AttachContainerOptions::<String>{
    stdin: Some(true),
    stdout: Some(true),
    stderr: Some(true),
    stream: Some(true),
    logs: Some(true),
    detach_keys: Some("ctrl-c".to_string()),
});

docker.attach_container("hello-world", options);
Source

pub async fn resize_container_tty( &self, container_name: &str, options: impl Into<ResizeContainerTTYOptions>, ) -> Result<(), Error>


§Resize container tty

Resize the container’s TTY.

§Arguments
§Examples

use bollard::container::ResizeContainerTtyOptions;

let options = ResizeContainerTtyOptions {
    width: 50,
    height: 20,
};

docker.resize_container_tty("hello-world", options);
Source

pub async fn restart_container( &self, container_name: &str, options: Option<impl Into<RestartContainerOptions>>, ) -> Result<(), Error>


§Restart Container

Restart a container.

§Arguments
§Returns
  • unit type (), wrapped in a Future.
§Examples

use bollard::container::RestartContainerOptions;

let options = Some(RestartContainerOptions{
    t: 30,
});

docker.restart_container("postgres", options);
Source

pub async fn inspect_container( &self, container_name: &str, options: Option<impl Into<InspectContainerOptions>>, ) -> Result<ContainerInspectResponse, Error>


§Inspect Container

Inspect a container.

§Arguments
§Returns
§Examples
use bollard::container::InspectContainerOptions;

let options = Some(InspectContainerOptions{
    size: false,
});

docker.inspect_container("hello-world", options);
Source

pub async fn top_processes( &self, container_name: &str, options: Option<impl Into<TopOptions>>, ) -> Result<ContainerTopResponse, Error>


§Top Processes

List processes running inside a container.

§Arguments
  • Container name as string slice.
  • Optional Top Options struct.
§Returns
§Examples
use bollard::container::TopOptions;

let options = Some(TopOptions{
    ps_args: "aux",
});

docker.top_processes("fussybeaver/uhttpd", options);
Source

pub fn logs( &self, container_name: &str, options: Option<impl Into<LogsOptions>>, ) -> impl Stream<Item = Result<LogOutput, Error>>


§Logs

Get container logs.

§Arguments
  • Container name as string slice.
  • Optional Logs Options struct.
§Returns
§Examples

use bollard::container::LogsOptions;

use std::default::Default;

let options = Some(LogsOptions::<String>{
    stdout: true,
    ..Default::default()
});

docker.logs("hello-world", options);
Source

pub async fn container_changes( &self, container_name: &str, ) -> Result<Option<Vec<FilesystemChange>>, Error>


§Container Changes

Get changes on a container’s filesystem.

§Arguments
  • Container name as string slice.
§Returns
§Examples

docker.container_changes("hello-world");
Source

pub fn stats( &self, container_name: &str, options: Option<impl Into<StatsOptions>>, ) -> impl Stream<Item = Result<ContainerStatsResponse, Error>>


§Stats

Get container stats based on resource usage.

§Arguments
§Returns
  • Stats struct, wrapped in a Stream.
§Examples

use bollard::container::StatsOptions;

let options = Some(StatsOptions{
    stream: false,
    one_shot: true,
});

docker.stats("hello-world", options);
Source

pub async fn kill_container( &self, container_name: &str, options: Option<impl Into<KillContainerOptions>>, ) -> Result<(), Error>


§Kill Container

Kill a container.

§Arguments
§Returns
  • unit type (), wrapped in a Future.
§Examples

use bollard::container::KillContainerOptions;

let options = Some(KillContainerOptions{
    signal: "SIGINT",
});

docker.kill_container("postgres", options);
Source

pub async fn update_container( &self, container_name: &str, config: impl Into<ContainerUpdateBody>, ) -> Result<(), Error>


§Update Container

Update a container.

§Arguments
§Returns
  • unit type (), wrapped in a Future.
§Examples

use bollard::container::UpdateContainerOptions;
use std::default::Default;

let config = UpdateContainerOptions::<String> {
    memory: Some(314572800),
    memory_swap: Some(314572800),
    ..Default::default()
};

docker.update_container("postgres", config);
Source

pub async fn rename_container( &self, container_name: &str, options: impl Into<RenameContainerOptions>, ) -> Result<(), Error>


§Rename Container

Rename a container.

§Arguments
§Returns
  • unit type (), wrapped in a Future.
§Examples

use bollard::container::RenameContainerOptions;

let required = RenameContainerOptions {
    name: "my_new_container_name"
};

docker.rename_container("hello-world", required);
Source

pub async fn pause_container(&self, container_name: &str) -> Result<(), Error>


§Pause Container

Use the cgroups freezer to suspend all processes in a container.

§Arguments
  • Container name as a string slice.
§Returns
  • unit type (), wrapped in a Future.
§Examples

docker.pause_container("postgres");
Source

pub async fn unpause_container(&self, container_name: &str) -> Result<(), Error>


§Unpause Container

Resume a container which has been paused.

§Arguments
  • Container name as a string slice.
§Returns
  • unit type (), wrapped in a Future.
§Examples

docker.unpause_container("postgres");
Source

pub async fn prune_containers( &self, options: Option<impl Into<PruneContainersOptions>>, ) -> Result<ContainerPruneResponse, Error>


§Prune Containers

Delete stopped containers.

§Arguments
§Returns
§Examples
use bollard::container::PruneContainersOptions;

use std::collections::HashMap;

let mut filters = HashMap::new();
filters.insert("until", vec!["10m"]);

let options = Some(PruneContainersOptions{
    filters
});

docker.prune_containers(options);
Source

pub async fn upload_to_container_streaming( &self, container_name: &str, options: Option<impl Into<UploadToContainerOptions>>, tar: impl Stream<Item = Bytes> + Send + 'static, ) -> Result<(), Error>

👎Deprecated since 0.19.0:

This method is refactored into upload_to_container


§Stream Upload To Container

Stream an upload of a tar archive to be extracted to a path in the filesystem of container id.

§Arguments
§Returns
  • unit type (), wrapped in a Future.
§Examples
use bollard::container::UploadToContainerOptions;
use futures_util::{StreamExt, TryFutureExt};
use tokio::fs::File;
use tokio_util::io::ReaderStream;

let options = Some(UploadToContainerOptions{
    path: "/opt",
    ..Default::default()
});

let file = File::open("tarball.tar.gz")
    .map_ok(ReaderStream::new)
    .try_flatten_stream()
    .map(|x|x.expect("failed to stream file"));

docker
    .upload_to_container_streaming("my-container", options, file)
    .await
    .expect("upload failed");
Source

pub async fn upload_to_container( &self, container_name: &str, options: Option<impl Into<UploadToContainerOptions>>, tar: Either<Full<Bytes>, StreamBody<Pin<Box<dyn Stream<Item = Result<Frame<Bytes>, Error>> + Send>>>>, ) -> Result<(), Error>


§Upload To Container

Upload a tar archive to be extracted to a path in the filesystem of container id.

§Arguments
§Returns
  • unit type (), wrapped in a Future.
§Examples

Uploading a tarball

use bollard::container::UploadToContainerOptions;
use bollard::body_full;
use std::fs::File;
use std::io::Read;

let options = Some(UploadToContainerOptions{
    path: "/opt",
    ..Default::default()
});

let mut file = File::open("tarball.tar.gz").unwrap();
let mut contents = Vec::new();
file.read_to_end(&mut contents).unwrap();

docker
    .upload_to_container("my-container", options, body_full(contents.into()))
    .await
    .expect("upload failed");

Uploading a stream

use bollard::container::UploadToContainerOptions;
use bollard::body_try_stream;
use futures_util::{StreamExt, TryFutureExt};
use tokio::fs::File;
use tokio_util::io::ReaderStream;

let options = Some(UploadToContainerOptions{
    path: "/opt",
    ..Default::default()
});

let file = File::open("tarball.tar.gz")
    .map_ok(ReaderStream::new)
    .try_flatten_stream();

docker
    .upload_to_container("my-container", options, body_try_stream(file))
    .await
    .expect("upload failed");
Source

pub fn download_from_container( &self, container_name: &str, options: Option<impl Into<DownloadFromContainerOptions>>, ) -> impl Stream<Item = Result<Bytes, Error>>


§Download From Container

Get a tar archive of a resource in the filesystem of container id.

§Arguments
§Returns
  • Tar archive compressed with one of the following algorithms: identity (no compression), gzip, bzip2, xz. Hyper Body.
§Examples
use bollard::container::DownloadFromContainerOptions;

let options = Some(DownloadFromContainerOptions{
    path: "/opt",
});

docker.download_from_container("my-container", options);
Source

pub fn export_container( &self, container_name: &str, ) -> impl Stream<Item = Result<Bytes, Error>>


§Export Container

Get a tarball containing the filesystem contents of a container.

See the Docker API documentation for more information.

§Arguments
  • The container_name string referring to an individual container
§Returns
  • An uncompressed TAR archive
Source

pub fn timeout(&self) -> Duration

Get the current timeout.

This timeout is shared by all requests to the Docker Engine API.

Source

pub fn set_timeout(&mut self, timeout: Duration)

Set the request timeout.

This timeout is shared by all requests to the Docker Engine API.

By default, 2 minutes.

Source

pub fn client_version(&self) -> ClientVersion

Return the currently set client version.

Source

pub async fn create_exec( &self, container_name: &str, config: impl Into<ExecConfig>, ) -> Result<CreateExecResults, Error>


§Create Exec

Run a command inside a running container.

§Arguments
§Returns
§Examples

use bollard::exec::CreateExecOptions;

use std::default::Default;

let config = CreateExecOptions {
    cmd: Some(vec!["ps", "-ef"]),
    attach_stdout: Some(true),
    ..Default::default()
};

docker.create_exec("hello-world", config);
Source

pub async fn start_exec( &self, exec_id: &str, config: Option<StartExecOptions>, ) -> Result<StartExecResults, Error>


§Start Exec

Starts a previously set up exec instance. If detach is true, this endpoint returns immediately after starting the command.

§Arguments
  • The ID of the previously created exec configuration.
§Returns
§Examples



async {
    let message = docker.create_exec("hello-world", config).await.unwrap();
    use bollard::exec::StartExecOptions;
    docker.start_exec(&message.id, None::<StartExecOptions>);
};
Source

pub async fn inspect_exec( &self, exec_id: &str, ) -> Result<ExecInspectResponse, Error>


§Inspect Exec

Return low-level information about an exec instance.

§Arguments
  • The ID of the previously created exec configuration.
§Returns
§Examples



async {
    let message = docker.create_exec("hello-world", config).await.unwrap();
    docker.inspect_exec(&message.id);
};
Source

pub async fn resize_exec( &self, exec_id: &str, options: impl Into<ResizeExecOptions>, ) -> Result<(), Error>


§Resize Exec

Resize the TTY session used by an exec instance. This endpoint only works if tty was specified as part of creating and starting the exec instance.

§Arguments
§Examples
async {
    let message = docker.create_exec("hello-world", config).await.unwrap();
    docker.resize_exec(&message.id, ResizeExecOptions {
        width: 80,
        height: 60
    });
};
Source

pub async fn list_images( &self, options: Option<impl Into<ListImagesOptions>>, ) -> Result<Vec<ImageSummary>, Error>


§List Images

Returns a list of images on the server. Note that it uses a different, smaller representation of an image than inspecting a single image

§Arguments
§Returns
§Examples
use bollard::image::ListImagesOptions;

use std::collections::HashMap;
use std::default::Default;

let mut filters = HashMap::new();
filters.insert("dangling", vec!["true"]);

let options = Some(ListImagesOptions{
  all: true,
  filters,
  ..Default::default()
});

docker.list_images(options);
Source

pub fn create_image( &self, options: Option<impl Into<CreateImageOptions>>, root_fs: Option<Either<Full<Bytes>, StreamBody<Pin<Box<dyn Stream<Item = Result<Frame<Bytes>, Error>> + Send>>>>>, credentials: Option<DockerCredentials>, ) -> impl Stream<Item = Result<CreateImageInfo, Error>>


§Create Image

Create an image by either pulling it from a registry or importing it.

§Arguments
  • An optional Create Image Options struct.
  • An optional request body consisting of a tar or tar.gz archive, or a stream containing the root file system for the image. If this argument is used, the value of the from_src option must be “-”.
§Returns
§Examples
use bollard::image::CreateImageOptions;

use std::default::Default;

let options = Some(CreateImageOptions{
  from_image: "hello-world",
  ..Default::default()
});

docker.create_image(options, None, None);

// do some other work while the image is pulled from the docker hub...
§Unsupported
  • Import from tarball
Source

pub async fn inspect_image( &self, image_name: &str, ) -> Result<ImageInspect, Error>


§Inspect Image

Return low-level information about an image.

§Arguments
  • Image name as a string slice.
§Returns
§Examples

use std::default::Default;

docker.inspect_image("hello-world");
Source

pub async fn inspect_registry_image( &self, image_name: &str, credentials: Option<DockerCredentials>, ) -> Result<DistributionInspect, Error>


§Inspect an Image by contacting the registry

Return image digest and platform information by contacting the registry

§Arguments
  • Image name as a string slice.
§Returns
§Examples
use bollard::Docker;
let docker = Docker::connect_with_http_defaults().unwrap();
docker.inspect_registry_image("ubuntu:jammy", None);
Source

pub async fn prune_images( &self, options: Option<impl Into<PruneImagesOptions>>, ) -> Result<ImagePruneResponse, Error>


§Prune Images

Delete unused images.

§Arguments
§Returns
§Examples
use bollard::image::PruneImagesOptions;

use std::collections::HashMap;

let mut filters = HashMap::new();
filters.insert("until", vec!["10m"]);

let options = Some(PruneImagesOptions {
  filters
});

docker.prune_images(options);
Source

pub async fn image_history( &self, image_name: &str, ) -> Result<Vec<HistoryResponseItem>, Error>


§Image History

Return parent layers of an image.

§Arguments
  • Image name as a string slice.
§Returns
§Examples

docker.image_history("hello-world");
Source

pub async fn search_images( &self, options: impl Into<SearchImagesOptions>, ) -> Result<Vec<ImageSearchResponseItem>, Error>


§Search Images

Search for an image on Docker Hub.

§Arguments
§Returns
§Examples

use bollard::image::SearchImagesOptions;
use std::default::Default;
use std::collections::HashMap;

let mut filters = HashMap::new();
filters.insert("until", vec!["10m"]);

let search_options = SearchImagesOptions {
    term: "hello-world",
    filters,
    ..Default::default()
};

docker.search_images(search_options);
Source

pub async fn remove_image( &self, image_name: &str, options: Option<impl Into<RemoveImageOptions>>, credentials: Option<DockerCredentials>, ) -> Result<Vec<ImageDeleteResponseItem>, Error>


§Remove Image

Remove an image, along with any untagged parent images that were referenced by that image.

§Arguments
§Returns
§Examples

use bollard::image::RemoveImageOptions;
use std::default::Default;

let remove_options = Some(RemoveImageOptions {
    force: true,
    ..Default::default()
});

docker.remove_image("hello-world", remove_options, None);
Source

pub async fn tag_image( &self, image_name: &str, options: Option<impl Into<TagImageOptions>>, ) -> Result<(), Error>


§Tag Image

Tag an image so that it becomes part of a repository.

§Arguments
§Returns
  • unit type (), wrapped in a Future.
§Examples

use bollard::image::TagImageOptions;
use std::default::Default;

let tag_options = Some(TagImageOptions {
    tag: "v1.0.1",
    ..Default::default()
});

docker.tag_image("hello-world", tag_options);
Source

pub fn push_image( &self, image_name: &str, options: Option<impl Into<PushImageOptions>>, credentials: Option<DockerCredentials>, ) -> impl Stream<Item = Result<PushImageInfo, Error>>


§Push Image

Push an image to a registry.

§Arguments
§Returns
  • unit type (), wrapped in a Future.
§Examples

use bollard::auth::DockerCredentials;
use bollard::image::PushImageOptions;

use std::default::Default;

let push_options = Some(PushImageOptions {
    tag: "v1.0.1",
});

let credentials = Some(DockerCredentials {
    username: Some("Jack".to_string()),
    password: Some("myverysecretpassword".to_string()),
    ..Default::default()
});

docker.push_image("hello-world", push_options, credentials);
Source

pub async fn commit_container( &self, options: impl Into<CommitContainerOptions>, config: impl Into<ContainerConfig>, ) -> Result<IdResponse, Error>


§Commit Container

Create a new image from a container.

§Arguments
§Returns
  • Commit, wrapped in a Future.
§Examples
use bollard::image::CommitContainerOptions;
use bollard::container::Config;

use std::default::Default;

let options = CommitContainerOptions{
    container: "my-running-container",
    pause: true,
    ..Default::default()
};

let config = Config::<String> {
    ..Default::default()
};

docker.commit_container(options, config);
Source

pub fn build_image( &self, options: impl Into<BuildImageOptions>, credentials: Option<HashMap<String, DockerCredentials>>, tar: Option<Either<Full<Bytes>, StreamBody<Pin<Box<dyn Stream<Item = Result<Frame<Bytes>, Error>> + Send>>>>>, ) -> impl Stream<Item = Result<BuildInfo, Error>>


§Build Image

Build an image from a tar archive with a Dockerfile in it.

The Dockerfile specifies how the image is built from the tar archive. It is typically in the archive’s root, but can be at a different path or have a different name by specifying the dockerfile parameter.

By default, the call to build specifies using BuilderV1, the first generation builder in docker daemon.

§Arguments
§Returns
§Examples

Sending a tarball:

use bollard::image::BuildImageOptions;
use bollard::container::Config;
use bollard::body_full;

use std::default::Default;
use std::fs::File;
use std::io::Read;

let options = BuildImageOptions{
    dockerfile: "Dockerfile",
    t: "my-image",
    rm: true,
    ..Default::default()
};

let mut file = File::open("tarball.tar.gz").unwrap();
let mut contents = Vec::new();
file.read_to_end(&mut contents).unwrap();

docker.build_image(options, None, Some(body_full(contents.into())));

Sending a stream:

use bollard::image::BuildImageOptions;
use bollard::container::Config;
use bollard::body_stream;

use std::default::Default;
use std::fs::File;
use std::io::Read;

let options = BuildImageOptions{
    dockerfile: "Dockerfile",
    t: "my-image",
    rm: true,
    ..Default::default()
};


docker.build_image(options, None, Some(body_stream(stream)));
Source

pub async fn prune_build( &self, options: Option<impl Into<PruneBuildOptions>>, ) -> Result<BuildPruneResponse, Error>


§Prune Build

Delete contents of the build cache

§Arguments
§Returns
§Examples
use bollard::image::PruneBuildOptions;

use std::collections::HashMap;

let mut filters = HashMap::new();
filters.insert("until", vec!["10m"]);

let options = Some(PruneBuildOptions {
  filters,
  ..Default::default()
});

docker.prune_build(options);
Source

pub fn export_image( &self, image_name: &str, ) -> impl Stream<Item = Result<Bytes, Error>>


§Export Image

Get a tarball containing all images and metadata for a repository.

The root of the resulting tar file will contain the file “manifest.json”. If the export is of an image repository, rather than a single image, there will also be a repositories file with a JSON description of the exported image repositories. Additionally, each layer of all exported images will have a sub directory in the archive containing the filesystem of the layer.

See the Docker API documentation for more information.

§Arguments
  • The image_name string referring to an individual image and tag (e.g. alpine:latest)
§Returns
  • An uncompressed TAR archive
Source

pub fn export_images( &self, image_names: &[&str], ) -> impl Stream<Item = Result<Bytes, Error>>


§Export Images

Get a tarball containing all images and metadata for several image repositories. Shared layers will be deduplicated.

See the Docker API documentation for more information.

§Arguments
  • The image_names Vec of image names.
§Returns
  • An uncompressed TAR archive
Source

pub fn import_image( &self, options: impl Into<ImportImageOptions>, root_fs: Either<Full<Bytes>, StreamBody<Pin<Box<dyn Stream<Item = Result<Frame<Bytes>, Error>> + Send>>>>, credentials: Option<HashMap<String, DockerCredentials>>, ) -> impl Stream<Item = Result<BuildInfo, Error>>


§Import Image

Load a set of images and tags into a repository.

For details on the format, see the export image endpoint.

§Arguments
§Returns
§Examples
use bollard::image::ImportImageOptions;
use bollard::errors::Error;
use bollard::body_full;

use std::default::Default;
use futures_util::stream::{StreamExt, TryStreamExt};
use tokio::fs::File;
use tokio::io::AsyncWriteExt;
use tokio_util::codec;

let options = ImportImageOptions{
    ..Default::default()
};

async move {
    let mut file = File::open("tarball.tar.gz").await.unwrap();

    let mut byte_stream = codec::FramedRead::new(file, codec::BytesCodec::new()).map(|r| {
        let bytes = r.unwrap().freeze();
        Ok::<_, Error>(bytes)
    });

    let bytes = byte_stream.next().await.unwrap().unwrap();

    let mut stream = docker
        .import_image(
            ImportImageOptions {
                ..Default::default()
            },
            body_full(bytes),
            None,
        );

    while let Some(response) = stream.next().await {
        // ...
    }
};
Source

pub fn import_image_stream( &self, options: impl Into<ImportImageOptions>, root_fs: impl Stream<Item = Bytes> + Send + 'static, credentials: Option<HashMap<String, DockerCredentials>>, ) -> impl Stream<Item = Result<BuildInfo, Error>>


§Import Image (stream)

Load a set of images and tags into a repository, without holding it all in memory at a given point in time

For details on the format, see the export image endpoint.

§Arguments
§Returns
§Examples
use bollard::image::ImportImageOptions;
use bollard::errors::Error;

use std::default::Default;
use futures_util::stream::{StreamExt, TryStreamExt};
use tokio::fs::File;
use tokio::io::AsyncWriteExt;
use tokio_util::codec;

let options = ImportImageOptions{
    ..Default::default()
};

async move {
    let mut file = File::open("tarball.tar.gz").await.unwrap();

    let mut byte_stream = codec::FramedRead::new(file, codec::BytesCodec::new()).map(|r| {
        r.unwrap().freeze()
    });

    let mut stream = docker
        .import_image_stream(
            ImportImageOptions {
                ..Default::default()
            },
            byte_stream,
            None,
        );

    while let Some(response) = stream.next().await {
        // ...
    }
};
Source

pub async fn create_network( &self, config: impl Into<NetworkCreateRequest>, ) -> Result<NetworkCreateResponse, Error>


§Create Network

Create a new network.

§Arguments
§Returns
§Examples

use bollard::network::CreateNetworkOptions;

use std::default::Default;

let config = CreateNetworkOptions {
    name: "certs",
    ..Default::default()
};

docker.create_network(config);
Source

pub async fn remove_network(&self, network_name: &str) -> Result<(), Error>


§Remove a Network
§Arguments
  • Network name as a string slice.
§Returns
  • unit type (), wrapped in a Future.
§Examples

docker.remove_network("my_network_name");
Source

pub async fn inspect_network( &self, network_name: &str, options: Option<impl Into<InspectNetworkOptions>>, ) -> Result<Network, Error>


§Inspect a Network
§Arguments
  • Network name as a string slice.
§Returns
  • A Models struct, wrapped in a Future.
§Examples

use bollard::network::InspectNetworkOptions;

use std::default::Default;

let config = InspectNetworkOptions {
    verbose: true,
    scope: "global"
};

docker.inspect_network("my_network_name", Some(config));
Source

pub async fn list_networks( &self, options: Option<impl Into<ListNetworksOptions>>, ) -> Result<Vec<Network>, Error>


§List Networks
§Arguments
§Returns
  • A vector of Network struct, wrapped in a Future.
§Examples

use bollard::network::ListNetworksOptions;

use std::collections::HashMap;

let mut list_networks_filters = HashMap::new();
list_networks_filters.insert("label", vec!["maintainer=some_maintainer"]);

let config = ListNetworksOptions {
    filters: list_networks_filters,
};

docker.list_networks(Some(config));
Source

pub async fn connect_network( &self, network_name: &str, config: impl Into<NetworkConnectRequest>, ) -> Result<(), Error>


§Connect Network
§Arguments
§Returns
  • unit type (), wrapped in a Future.
§Examples

use bollard::network::ConnectNetworkOptions;
use bollard::models::{EndpointSettings, EndpointIpamConfig};

use std::default::Default;

let config = ConnectNetworkOptions {
    container: "3613f73ba0e4",
    endpoint_config: EndpointSettings {
        ipam_config: Some(EndpointIpamConfig {
            ipv4_address: Some(String::from("172.24.56.89")),
            ipv6_address: Some(String::from("2001:db8::5689")),
            ..Default::default()
        }),
        ..Default::default()
    }
};

docker.connect_network("my_network_name", config);
Source

pub async fn disconnect_network( &self, network_name: &str, config: impl Into<NetworkDisconnectRequest>, ) -> Result<(), Error>


§Disconnect Network
§Arguments
§Returns
  • unit type (), wrapped in a Future.
§Examples

use bollard::network::DisconnectNetworkOptions;

use std::default::Default;

let config = DisconnectNetworkOptions {
    container: "3613f73ba0e4",
    force: true
};

docker.disconnect_network("my_network_name", config);
Source

pub async fn prune_networks( &self, options: Option<impl Into<PruneNetworksOptions>>, ) -> Result<NetworkPruneResponse, Error>


§Prune Networks

Deletes networks which are unused.

§Arguments
§Returns
§Examples

use bollard::network::PruneNetworksOptions;

use std::collections::HashMap;

let mut filters = HashMap::new();
filters.insert("label", vec!["maintainer=some_maintainer"]);

let options = PruneNetworksOptions {
    filters,
};

docker.prune_networks(Some(options));
Source

pub async fn list_nodes( &self, options: Option<impl Into<ListNodesOptions>>, ) -> Result<Vec<Node>, Error>


§List Nodes
§Arguments
§Returns
  • A vector of Node struct, wrapped in a Future.
§Examples

use bollard::node::ListNodesOptions;

use std::collections::HashMap;

let mut list_nodes_filters = HashMap::new();
list_nodes_filters.insert("node.label", vec!["my-node-label"]);

let config = ListNodesOptions {
    filters: list_nodes_filters,
};

docker.list_nodes(Some(config));
Source

pub async fn inspect_node(&self, node_name: &str) -> Result<Node, Error>


§Inspect a Node
§Arguments
  • Node id or name as a string slice.
§Returns
  • A Models struct, wrapped in a Future.
§Examples

docker.inspect_node("my_node_name");
Source

pub async fn delete_node( &self, node_name: &str, options: Option<impl Into<DeleteNodeOptions>>, ) -> Result<(), Error>


§Delete Node

Delete a node.

§Arguments
§Returns
  • unit type (), wrapped in a Future.
§Examples

use bollard::node::DeleteNodeOptions;

let options = Some(DeleteNodeOptions {
    force: true,
    ..Default::default()
});

docker.delete_node("my-node", options);
Source

pub async fn update_node( &self, node_id: &str, spec: NodeSpec, options: impl Into<UpdateNodeOptions>, ) -> Result<(), Error>


§Update Node

Update a node.

§Arguments
§Returns
  • unit type (), wrapped in a Future.
§Examples

use bollard::node::UpdateNodeOptions;
use bollard::models::{NodeSpec, NodeSpecAvailabilityEnum, NodeSpecRoleEnum};

let spec = NodeSpec {
    availability: Some(NodeSpecAvailabilityEnum::ACTIVE),
    name: Some("my-new-node-name".to_string()),
    role: Some(NodeSpecRoleEnum::MANAGER),
    ..Default::default()
};

let options = UpdateNodeOptions {
    version: 2,
    ..Default::default()
};

docker.update_node("my-node-id", spec, options);
Source

pub async fn list_secrets( &self, options: Option<impl Into<ListSecretsOptions>>, ) -> Result<Vec<Secret>, Error>


§List Secrets

Returns a list of secrets.

§Arguments
§Returns
  • Vector of Secret, wrapped in a Future.
§Examples
use bollard::secret::ListSecretsOptions;

use std::collections::HashMap;
use std::default::Default;

let mut filters = HashMap::new();
filters.insert("label", vec!["secret-label=label-value"]);

let options = Some(ListSecretsOptions{
    filters,
    ..Default::default()
});

docker.list_secrets(options);
Source

pub async fn create_secret( &self, secret_spec: SecretSpec, ) -> Result<IdResponse, Error>


§Create Secret

Create new secret on the docker swarm.

§Arguments
§Returns
§Examples
use bollard::secret::SecretSpec;

use base64;

let secret_spec = SecretSpec {
    name: Some(String::from("secret-name")),
    data: Some(base64::engine::general_purpose::STANDARD.encode("secret-data")),
    ..Default::default()
};

docker.create_secret(secret_spec);
Source

pub async fn inspect_secret(&self, secret_id: &str) -> Result<Secret, Error>


§Inspect Secret

Inspect a secret.

§Arguments
  • Secret id or name as a string slice.
§Returns
  • Secret, wrapped in a Future.
§Examples

docker.inspect_secret("secret-id");
docker.inspect_secret("secret-name");
Source

pub async fn delete_secret(&self, secret_id: &str) -> Result<(), Error>


§Delete Secret

Delete a secret, fails when more than one service use that secret..

§Arguments
  • Secret id or name as a string slice.
§Returns
  • unit type (), wrapped in a Future.
§Examples

docker.delete_secret("secret-id");
docker.delete_secret("secret-name");
Source

pub async fn update_secret( &self, secret_id: &str, secret_spec: SecretSpec, options: impl Into<UpdateSecretOptions>, ) -> Result<(), Error>


§Update Secret

Update an existing secret, fails when more than one service use that secret or trying update data.

§Arguments
§Returns
  • unit type (), wrapped in a Future.
§Examples

use std::collections::HashMap;
use bollard::secret::UpdateSecretOptions;

let result = async move {
    let existing = docker.inspect_secret("my-secret").await?;
    let version = existing.version.unwrap().index.unwrap();
    let mut spec = existing.spec.unwrap().clone();

    let mut labels = HashMap::new();
    labels.insert(String::from("secret-label"), String::from("label-value"));
    spec.labels = Some(labels.clone());

    let options = UpdateSecretOptions { version };

    docker.update_secret("my-secret", spec, options).await
};
Source

pub async fn list_services( &self, options: Option<impl Into<ListServicesOptions>>, ) -> Result<Vec<Service>, Error>


§List Services

Returns a list of services.

§Arguments
§Returns
  • Vector of Services, wrapped in a Future.
§Examples
use bollard::service::ListServicesOptions;

use std::collections::HashMap;
use std::default::Default;

let mut filters = HashMap::new();
filters.insert("mode", vec!["global"]);

let options = Some(ListServicesOptions{
    filters,
    ..Default::default()
});

docker.list_services(options);
Source

pub async fn create_service( &self, service_spec: ServiceSpec, credentials: Option<DockerCredentials>, ) -> Result<ServiceCreateResponse, Error>


§Create Service

Dispatch a new service on the docker swarm

§Arguments
§Returns
§Examples
use bollard::service::{
    ServiceSpec,
    ServiceSpecMode,
    ServiceSpecModeReplicated,
    TaskSpec,
    TaskSpecContainerSpec
};

let service = ServiceSpec {
    name: Some(String::from("my-service")),
    mode: Some(ServiceSpecMode {
        replicated: Some(ServiceSpecModeReplicated {
            replicas: Some(2)
        }),
        ..Default::default()
    }),
    task_template: Some(TaskSpec {
        container_spec: Some(TaskSpecContainerSpec {
            image: Some(String::from("hello-world")),
            ..Default::default()
        }),
        ..Default::default()
    }),
    ..Default::default()
};
let credentials = None;

docker.create_service(service, credentials);
Source

pub async fn inspect_service( &self, service_name: &str, options: Option<impl Into<InspectServiceOptions>>, ) -> Result<Service, Error>


§Inspect Service

Inspect a service.

§Arguments
§Returns
§Examples
use bollard::service::InspectServiceOptions;

let options = Some(InspectServiceOptions{
    insert_defaults: true,
});

docker.inspect_service("my-service", options);
Source

pub async fn delete_service(&self, service_name: &str) -> Result<(), Error>


§Delete Service

Delete a service.

§Arguments
  • Service name or id as a string slice.
§Returns
  • unit type (), wrapped in a Future.
§Examples

docker.delete_service("my-service");
Source

pub async fn update_service( &self, service_name: &str, service_spec: ServiceSpec, options: impl Into<UpdateServiceOptions>, credentials: Option<DockerCredentials>, ) -> Result<ServiceUpdateResponse, Error>


§Update Service

Update an existing service

§Arguments
§Returns
§Examples
use bollard::service::{
    InspectServiceOptions,
    ServiceSpec,
    ServiceSpecMode,
    ServiceSpecModeReplicated,
    TaskSpec,
    TaskSpecContainerSpec,
    UpdateServiceOptions,
};

use std::collections::HashMap;
use std::default::Default;

let result = async move {
    let service_name = "my-service";
    let current_version = docker.inspect_service(
        service_name,
        None::<InspectServiceOptions>
    ).await?.version.unwrap().index.unwrap();
    let service = ServiceSpec {
        mode: Some(ServiceSpecMode {
            replicated: Some(ServiceSpecModeReplicated {
                replicas: Some(0)
            }),
            ..Default::default()
        }),
        ..Default::default()
    };
    let options = UpdateServiceOptions {
        version: current_version,
        ..Default::default()
    };
    let credentials = None;

    docker.update_service("my-service", service, options, credentials).await
};
Source

pub async fn init_swarm( &self, config: impl Into<SwarmInitRequest>, ) -> Result<String, Error>


§Init Swarm

Initialize a new swarm.

§Arguments
§Returns
  • A String wrapped in a Future.
§Examples

use std::default::Default;

let config = InitSwarmOptions {
    advertise_addr: "127.0.0.1",
    listen_addr: "0.0.0.0:2377"
};

docker.init_swarm(config);
Source

pub async fn inspect_swarm(&self) -> Result<Swarm, Error>


§Inspect Swarm

Inspect swarm.

§Arguments
§Returns
  • Swarm struct, wrapped in a Future.
§Examples

docker.inspect_swarm();
Source

pub async fn join_swarm( &self, config: impl Into<SwarmJoinRequest>, ) -> Result<(), Error>


§Join a Swarm
§Arguments
§Returns
  • unit type (), wrapped in a Future.
§Examples

let config = JoinSwarmOptions {
    advertise_addr: "127.0.0.1",
    join_token: "token",
};
docker.join_swarm(config);
Source

pub async fn leave_swarm( &self, options: Option<impl Into<LeaveSwarmOptions>>, ) -> Result<(), Error>


§Leave a Swarm
§Arguments
§Returns
  • unit type (), wrapped in a Future.
§Examples

docker.leave_swarm(None::<LeaveSwarmOptions>);
Source

pub async fn version(&self) -> Result<SystemVersion, Error>


§Version

Returns the version of Docker that is running and various information about the system that Docker is running on.

§Returns
§Examples
docker.version();
Source

pub async fn info(&self) -> Result<SystemInfo, Error>


§Info

Returns Docker client and server information that is running.

§Returns
  • Info, wrapped in a Future.
§Examples
docker.info();
Source

pub async fn ping(&self) -> Result<String, Error>


§Ping

This is a dummy endpoint you can use to test if the server is accessible.

§Returns - A String, wrapped in a Future. # Examples

docker.ping();
Source

pub fn events( &self, options: Option<impl Into<EventsOptions>>, ) -> impl Stream<Item = Result<EventMessage, Error>>


§Events

Stream real-time events from the server.

§Returns
§Examples
use bollard::system::EventsOptions;
use time::{Duration, OffsetDateTime};
use std::collections::HashMap;


docker.events(Some(EventsOptions::<String> {
    since: Some(OffsetDateTime::now_utc() - Duration::minutes(20)),
    until: Some(OffsetDateTime::now_utc()),
    filters: HashMap::new(),
}));
Source

pub async fn df( &self, options: Option<DataUsageOptions>, ) -> Result<SystemDataUsageResponse, Error>


§Get data usage information

Show docker disk usage

§Returns
§Examples
docker.df(None::<DataUsageOptions>);
Source

pub async fn list_tasks( &self, options: Option<impl Into<ListTasksOptions>>, ) -> Result<Vec<Task>, Error>


§List Tasks
§Arguments
§Returns
  • A vector of Task struct, wrapped in a Future.
§Examples

use bollard::task::ListTasksOptions;

use std::collections::HashMap;

let mut list_tasks_filters = HashMap::new();
list_tasks_filters.insert("label", vec!["my-task-label"]);

let config = ListTasksOptions {
    filters: list_tasks_filters,
};

docker.list_tasks(Some(config));
Source

pub async fn inspect_task(&self, task_id: &str) -> Result<Task, Error>


§Inspect a Task
§Arguments
  • Task id as a string slice.
§Returns
  • A Models struct, wrapped in a Future.
§Examples

docker.inspect_task("my_task_id");
Source

pub async fn list_volumes( &self, options: Option<impl Into<ListVolumesOptions>>, ) -> Result<VolumeListResponse, Error>


§List volumes
§Arguments
§Returns
  • A [Volume List Response]VolumeListResponse) struct, wrapped in a Future.
§Examples

use bollard::volume::ListVolumesOptions;

use std::collections::HashMap;

let mut filters = HashMap::new();
filters.insert("dangling", vec!("1"));

let options = ListVolumesOptions {
    filters,
};

docker.list_volumes(Some(options));
Source

pub async fn create_volume( &self, config: impl Into<VolumeCreateOptions>, ) -> Result<Volume, Error>


§Create Volume

Create a new volume.

§Arguments
§Returns
  • A Volume struct, wrapped in a Future.
§Examples

use bollard::volume::CreateVolumeOptions;

use std::default::Default;

let config = CreateVolumeOptions {
    name: "certs",
    ..Default::default()
};

docker.create_volume(config);
Source

pub async fn inspect_volume(&self, volume_name: &str) -> Result<Volume, Error>


§Inspect a Volume
§Arguments
  • Volume name as a string slice.
§Returns
  • A Volume struct, wrapped in a Future.
§Examples

docker.inspect_volume("my_volume_name");
Source

pub async fn remove_volume( &self, volume_name: &str, options: Option<impl Into<RemoveVolumeOptions>>, ) -> Result<(), Error>


§Remove a Volume
§Arguments
  • Volume name as a string slice.
§Arguments
§Returns
  • unit type (), wrapped in a Future.
§Examples

use bollard::volume::RemoveVolumeOptions;

let options = RemoveVolumeOptions {
    force: true,
};

docker.remove_volume("my_volume_name", Some(options));
Source

pub async fn prune_volumes( &self, options: Option<impl Into<PruneVolumesOptions>>, ) -> Result<VolumePruneResponse, Error>


§Prune Volumes

Delete unused volumes.

§Arguments
§Returns
§Examples

use bollard::volume::PruneVolumesOptions;

use std::collections::HashMap;

let mut filters = HashMap::new();
filters.insert("label", vec!["maintainer=some_maintainer"]);

let options = PruneVolumesOptions {
    filters,
};

docker.prune_volumes(Some(options));

Trait Implementations§

Source§

impl Borrow<Docker> for Docker

Source§

fn borrow(&self) -> &Client

Immutably borrows from an owned value. Read more
Source§

impl BorrowMut<Docker> for Docker

Source§

fn borrow_mut(&mut self) -> &mut Client

Mutably borrows from an owned value. Read more
Source§

impl Clone for Docker

Source§

fn clone(&self) -> Docker

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Docker

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Deref for Docker

Source§

type Target = Docker

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl DerefMut for Docker

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
Source§

impl From<Docker> for Docker

Source§

fn from(client: Client) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> Conv for T

Source§

fn conv<T>(self) -> T
where Self: Into<T>,

Converts self into T using Into<T>. Read more
Source§

impl<T> FmtForward for T

Source§

fn fmt_binary(self) -> FmtBinary<Self>
where Self: Binary,

Causes self to use its Binary implementation when Debug-formatted.
Source§

fn fmt_display(self) -> FmtDisplay<Self>
where Self: Display,

Causes self to use its Display implementation when Debug-formatted.
Source§

fn fmt_lower_exp(self) -> FmtLowerExp<Self>
where Self: LowerExp,

Causes self to use its LowerExp implementation when Debug-formatted.
Source§

fn fmt_lower_hex(self) -> FmtLowerHex<Self>
where Self: LowerHex,

Causes self to use its LowerHex implementation when Debug-formatted.
Source§

fn fmt_octal(self) -> FmtOctal<Self>
where Self: Octal,

Causes self to use its Octal implementation when Debug-formatted.
Source§

fn fmt_pointer(self) -> FmtPointer<Self>
where Self: Pointer,

Causes self to use its Pointer implementation when Debug-formatted.
Source§

fn fmt_upper_exp(self) -> FmtUpperExp<Self>
where Self: UpperExp,

Causes self to use its UpperExp implementation when Debug-formatted.
Source§

fn fmt_upper_hex(self) -> FmtUpperHex<Self>
where Self: UpperHex,

Causes self to use its UpperHex implementation when Debug-formatted.
Source§

fn fmt_list(self) -> FmtList<Self>
where &'a Self: for<'a> IntoIterator,

Formats each item in a sequence. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> IntoSql for T

Source§

fn into_sql<T>(self) -> Self::Expression

Convert self to an expression for Diesel’s query builder. Read more
Source§

fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression
where &'a Self: AsExpression<T>, T: SqlType + TypedExpressionType,

Convert &self to an expression for Diesel’s query builder. Read more
Source§

impl<T> Pipe for T
where T: ?Sized,

Source§

fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> R
where Self: Sized,

Pipes by value. This is generally the method you want to use. Read more
Source§

fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> R
where R: 'a,

Borrows self and passes that borrow into the pipe function. Read more
Source§

fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> R
where R: 'a,

Mutably borrows self and passes that borrow into the pipe function. Read more
Source§

fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
where Self: Borrow<B>, B: 'a + ?Sized, R: 'a,

Borrows self, then passes self.borrow() into the pipe function. Read more
Source§

fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
where Self: BorrowMut<B>, B: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.borrow_mut() into the pipe function. Read more
Source§

fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
where Self: AsRef<U>, U: 'a + ?Sized, R: 'a,

Borrows self, then passes self.as_ref() into the pipe function.
Source§

fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
where Self: AsMut<U>, U: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.as_mut() into the pipe function.
Source§

fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
where Self: Deref<Target = T>, T: 'a + ?Sized, R: 'a,

Borrows self, then passes self.deref() into the pipe function.
Source§

fn pipe_deref_mut<'a, T, R>( &'a mut self, func: impl FnOnce(&'a mut T) -> R, ) -> R
where Self: DerefMut<Target = T> + Deref, T: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.deref_mut() into the pipe function.
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> Tap for T

Source§

fn tap(self, func: impl FnOnce(&Self)) -> Self

Immutable access to a value. Read more
Source§

fn tap_mut(self, func: impl FnOnce(&mut Self)) -> Self

Mutable access to a value. Read more
Source§

fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
where Self: Borrow<B>, B: ?Sized,

Immutable access to the Borrow<B> of a value. Read more
Source§

fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
where Self: BorrowMut<B>, B: ?Sized,

Mutable access to the BorrowMut<B> of a value. Read more
Source§

fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
where Self: AsRef<R>, R: ?Sized,

Immutable access to the AsRef<R> view of a value. Read more
Source§

fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
where Self: AsMut<R>, R: ?Sized,

Mutable access to the AsMut<R> view of a value. Read more
Source§

fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
where Self: Deref<Target = T>, T: ?Sized,

Immutable access to the Deref::Target of a value. Read more
Source§

fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

Mutable access to the Deref::Target of a value. Read more
Source§

fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self

Calls .tap() only in debug builds, and is erased in release builds.
Source§

fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self

Calls .tap_mut() only in debug builds, and is erased in release builds.
Source§

fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
where Self: Borrow<B>, B: ?Sized,

Calls .tap_borrow() only in debug builds, and is erased in release builds.
Source§

fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
where Self: BorrowMut<B>, B: ?Sized,

Calls .tap_borrow_mut() only in debug builds, and is erased in release builds.
Source§

fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
where Self: AsRef<R>, R: ?Sized,

Calls .tap_ref() only in debug builds, and is erased in release builds.
Source§

fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
where Self: AsMut<R>, R: ?Sized,

Calls .tap_ref_mut() only in debug builds, and is erased in release builds.
Source§

fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
where Self: Deref<Target = T>, T: ?Sized,

Calls .tap_deref() only in debug builds, and is erased in release builds.
Source§

fn tap_deref_mut_dbg<T>(self, func: impl FnOnce(&mut T)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

Calls .tap_deref_mut() only in debug builds, and is erased in release builds.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> TryConv for T

Source§

fn try_conv<T>(self) -> Result<T, Self::Error>
where Self: TryInto<T>,

Attempts to convert self into T using TryInto<T>. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T