| Crates.io | x11docker-rs |
| lib.rs | x11docker-rs |
| version | 0.1.0 |
| created_at | 2025-01-17 12:25:51.714396+00 |
| updated_at | 2025-01-17 12:25:51.714396+00 |
| description | A x11docker wrapper for Rust. |
| homepage | |
| repository | https://github.com/STRUCTiX/x11docker-rs |
| max_upload_size | |
| id | 1520556 |
| size | 23,561 |
The X11docker library is a Rust wrapper for the x11docker script. It allows you to build arguments, spawn X11docker commands, and terminate the running child processes conveniently.
exec() method.libc).Below is an example of how to use the X11docker library in your project.
Add the following to your Cargo.toml file to use X11docker:
[dependencies]
x11docker = "0.1.0"
use x11docker::X11docker;
use std::collections::HashSet;
fn main() {
// Create a new instance of X11docker
let mut x11docker = X11docker::default()
.internet()
.image_name("my_docker_image")
.container_name("my_container")
.use_xpra();
// Execute the x11docker command
match x11docker.exec() {
Ok(_) => println!("X11docker started successfully!"),
Err(e) => eprintln!("Failed to start x11docker container: {e}"),
}
// Perform operations...
// Terminate the running child process
if let Err(e) = x11docker.terminate() {
eprintln!("Failed to terminate the process: {e}");
}
}
X11dockerThe main struct of the library used to configure and manage X11docker processes.
arguments: Method to set arguments explicitly.internet: Adds the Internet option, allowing internet access in the container.image_name(name: &str): Adds the specified image name to the arguments.container_name(name: &str): Adds the specified container name to the arguments.use_xpra(): Adds the Xpra option to use Xpra for X11 forwarding.exec(): Executes the X11docker command with the configured arguments.terminate(): Terminates the running X11docker child process.X11dockerOptionEnum that defines different options available for X11docker.
Internet: Enables internet access for the container.ImageName(String): Specifies the Docker image name.ContainerName(String): Specifies the container name.Xpra: Enables Xpra for remote GUI access.exec() function requires that the x11docker script be available in your system's PATH. Otherwise, it will return an error.terminate() method uses Unix signals to kill the child process, making it incompatible with non-Unix platforms.This project is licensed under the MIT License. See the LICENSE file for more details.
Contributions are welcome! Feel free to open issues or submit pull requests.