https://github.com/zingerlittlebee/port-killer-rs
port killer for rust
https://github.com/zingerlittlebee/port-killer-rs
Last synced: about 1 year ago
JSON representation
port killer for rust
- Host: GitHub
- URL: https://github.com/zingerlittlebee/port-killer-rs
- Owner: ZingerLittleBee
- License: mit
- Created: 2022-05-07T07:43:54.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2024-02-11T20:57:56.000Z (over 2 years ago)
- Last Synced: 2024-11-06T20:11:51.930Z (over 1 year ago)
- Language: Rust
- Homepage: https://crates.io/crates/port-killer
- Size: 23.4 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Language : 🇺🇸 English | [🇨🇳 ç®€ä½“ä¸æ–‡](./README.zh-CN.md)
port-killer
[](https://crates.io/crates/port-killer)


[](https://docs.rs/port-killer/0.1.0/port_killer/)
[](https://github.com/ZingerLittleBee/port-killer-rs/actions)
[](./LICENSE)
## Overview
port-killer is a rust library that provides functions to **clear port occupancy** and **kill processes**.
## Installation
1. Get the latest version -> https://crates.io/crates/port-killer
2. Add the dependent
```toml
[dependencies]
port-killer = "0.1.0"
```
3. Usage
```rust
use port_killer::{kill, kill_by_pids};
fn main() {
assert!(kill(5000).expect(""));
assert!(kill_by_pids(&[56812]).expect(""));
}
```
## Goods
fn -> [kill](#kill) · [kill_by_pids](#kill_by_pids)
## Documentation
### `kill`
Clear port occupancy by port
```rust
pub fn kill(port: u16) -> Result
```
### `kill_by_pids`
Kill processes based on pids
```rust
pub fn kill_by_pids(pids: &[u32]) -> Result
```