Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix lifetimes #272

Merged
merged 12 commits into from
Feb 21, 2021
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
* support for uploading tar to container [#239](https://github.com/softprops/shiplift/pull/239)
* fix registry authentication to use URL-safe base64 encoding [#245](https://github.com/softprops/shiplift/pull/245)
* add StopSignal and StopTimeout to ContainerOptionsBuilder [#248](https://github.com/softprops/shiplift/pull/248)
* update lifetimes of various methods to avoid `temporary value dropped while borrowed` errors [#272](https://github.com/softprops/shiplift/pull/272)

# 0.6.0

Expand Down
3 changes: 1 addition & 2 deletions examples/attach.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
.nth(1)
.expect("You need to specify a container id");

let containers = docker.containers();
let tty_multiplexer = containers.get(&id).attach().await?;
let tty_multiplexer = docker.containers().get(&id).attach().await?;

let (mut reader, _writer) = tty_multiplexer.split();

Expand Down
5 changes: 2 additions & 3 deletions examples/containerlogs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@ async fn main() {
.nth(1)
.expect("You need to specify a container id");

let containers = docker.containers();

let mut logs_stream = containers
let mut logs_stream = docker
.containers()
.get(&id)
.logs(&LogsOptions::builder().stdout(true).stderr(true).build());

Expand Down
4 changes: 1 addition & 3 deletions examples/export.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ async fn main() {
.open(format!("{}.tar", &id))
.unwrap();

let images = docker.images();

while let Some(export_result) = images.get(&id).export().next().await {
while let Some(export_result) = docker.images().get(&id).export().next().await {
match export_result.and_then(|bytes| export_file.write(&bytes).map_err(Error::from)) {
Ok(n) => println!("copied {} bytes", n),
Err(e) => eprintln!("Error: {}", e),
Expand Down
5 changes: 1 addition & 4 deletions examples/imagebuild.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@ async fn main() {

let options = BuildOptions::builder(path).tag("shiplift_test").build();

let images = docker.images();

let mut stream = images.build(&options);

let mut stream = docker.images().build(&options);
while let Some(build_result) = stream.next().await {
match build_result {
Ok(output) => println!("{:?}", output),
Expand Down
5 changes: 2 additions & 3 deletions examples/networkdisconnect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@ async fn network_disconnect(
network_id: &str,
) {
let docker = Docker::new();
let networks = docker.networks();

if let Err(e) = networks
if let Err(e) = docker
.networks()
.get(network_id)
.disconnect(&ContainerConnectionOptions::builder(container_id).build())
.await
Expand Down
5 changes: 2 additions & 3 deletions examples/servicelogs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@ async fn main() {
.nth(1)
.expect("You need to specify a service name");

let services = docker.services();

let mut logs_stream = services
let mut logs_stream = docker
.services()
.get(&id)
.logs(&LogsOptions::builder().stdout(true).stderr(true).build());

Expand Down
4 changes: 2 additions & 2 deletions examples/volumecreate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ use std::{collections::HashMap, env};
#[tokio::main]
async fn main() {
let docker = Docker::new();
let volumes = docker.volumes();

let volume_name = env::args()
.nth(1)
Expand All @@ -13,7 +12,8 @@ async fn main() {
let mut labels = HashMap::new();
labels.insert("com.github.softprops", "shiplift");

match volumes
match docker
.volumes()
.create(
&VolumeCreateOptions::builder()
.name(volume_name.as_ref())
Expand Down
3 changes: 1 addition & 2 deletions examples/volumedelete.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@ use std::env;
#[tokio::main]
async fn main() {
let docker = Docker::new();
let volumes = docker.volumes();

let volume_name = env::args()
.nth(1)
.expect("You need to specify an volume name");

if let Err(e) = volumes.get(&volume_name).delete().await {
if let Err(e) = docker.volumes().get(&volume_name).delete().await {
eprintln!("Error: {}", e)
}
}
4 changes: 1 addition & 3 deletions examples/volumes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ use shiplift::Docker;
#[tokio::main]
async fn main() {
let docker = Docker::new();
let volumes = docker.volumes();

match volumes.list().await {
match docker.volumes().list().await {
Ok(volumes) => {
for v in volumes {
println!("volume -> {:#?}", v)
Expand Down
Loading