Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#Build convenience

lint:
cargo clippy --all-targets --all-features -- -D clippy::all
cargo fmt --all -- --check

test:
docker pull ubuntu:latest
cargo test --all-features --all-targets
cargo test --doc
17 changes: 17 additions & 0 deletions src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -298,4 +298,21 @@ macro_rules! impl_api_ep {
}
}}
};
(
Reize $it:ident: $base:ident -> $resp:ident $ep:expr, $ret:expr $(, $extra:expr)*
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd suggest implementing it straight in src/api/container.rs as this macros are mostly for methods that appear on multiple structs like inspect or list. As the time passes I'm personally leaning more towards implementing it directly for each struct rather than by macro as it improves code search-ability.

) => {
paste::item! {
api_doc! { $base => Resize
|
#[doc = concat!("Resizes TTY of container ", stringify!($base), ".")]
pub fn resize(&self, opts: &[< $base ResizeOpts >]) -> Result<$ret> {
self.docker
.post_json(
&containers_api::url::construct_ep($ep, opts.serialize()),
crate::conn:Payload::empty(),
crate::conn::Headers::none(),
).await
}}
}
};
}
5 changes: 1 addition & 4 deletions tests/docker_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@ async fn docker_info() {
let info_result = docker.info().await;
assert!(info_result.is_ok());
let info_data = info_result.unwrap();
assert_eq!(
info_data.name.unwrap(),
gethostname::gethostname().into_string().unwrap()
);
assert_eq!(info_data.os_type.unwrap(), "linux".to_string());
}

#[tokio::test]
Expand Down