From e97bf7175ddf063788df2fa630b4dedcd19388a0 Mon Sep 17 00:00:00 2001 From: Keir Lawson Date: Sat, 18 May 2019 02:44:53 +0100 Subject: Switch path type requirement to make more ergonomic (#168) --- examples/containercopyinto.rs | 4 ++-- src/lib.rs | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/examples/containercopyinto.rs b/examples/containercopyinto.rs index fb2de50..63f0a2d 100644 --- a/examples/containercopyinto.rs +++ b/examples/containercopyinto.rs @@ -1,5 +1,5 @@ use shiplift::Docker; -use std::{env, path}; +use std::env; use tokio::prelude::Future; fn main() { @@ -21,7 +21,7 @@ fn main() { let fut = docker .containers() .get(&id) - .copy_file_into(path::Path::new(&path), &bytes[..]) + .copy_file_into(path, &bytes[..]) .map_err(|e| eprintln!("Error: {}", e)); tokio::run(fut); } diff --git a/src/lib.rs b/src/lib.rs index 61a8bde..e999ba7 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -518,11 +518,13 @@ impl<'a, 'b> Container<'a, 'b> { /// The file will be copied at the given location (see `path`) and will be owned by root /// with access mask 644. The specified `path` parent location must exists, otherwise the /// creation of the file fails. - pub fn copy_file_into( + pub fn copy_file_into>( &self, - path: &Path, + path: P, bytes: &[u8], ) -> impl Future { + let path = path.as_ref(); + let mut ar = tar::Builder::new(Vec::new()); let mut header = tar::Header::new_gnu(); header.set_size(bytes.len() as u64); -- cgit v1.2.3