A versatile Rust library and command-line tool for waiting on network resources to become available. It can be seamlessly integrated into Rust projects as a library or used as a standalone command-line utility. Additionally, it can be easily incorporated into Dockerfiles for containerized environments.
- Flexible: It can be used as both a library and a command-line tool, offering flexibility in integration and usage.
- Easy Installation: The command-line tool can be installed globally and used directly in shell scripts or Dockerfiles.
- Network Resource Waiting: Use
wait-for-rs
to wait for network resources such as URLs and TCP sockets to become available. - Customizable: Configure wait durations, timeouts, and intervals according to your specific requirements.
To install wait-for-rs as a command-line tool, simply run:
cd wait-for-rs && cargo install --path .
To use wait-for-rs as a library in your Rust project, add the following to your Cargo.toml:
[dependencies]
wait-for-rs = { git = "https://github.com/PanGan21/wait-for-rs.git", branch = "main" }
To start the server:
# Wait for a TCP socket to become available
wait-for-rs 127.0.0.1:8080 --timeout 60
use wait_for_rs::{WaitService, Result};
fn main() -> Result<()> {
// Create a WaitService instance and wait for services
let wait_service = WaitService::new(vec!["google.com:443".to_string()], 30)?;
wait_service.wait_for_services()?;
Ok(())
}
For more detailed usage instructions and API documentation, please refer to the examples.
cargo test
This project is licensed under the MIT License - see the LICENSE file for details.