Add this package to Cargo.toml
of your project. (Check https://crates.io/crates/port-alloc for right version)
toml
[dependencies]
port-alloc = "0.1.0"
```rust use port_alloc::PortAlloc; use std::time::Duration;
let allocator = PortAlloc::new(20000, 65535, Duration::fromseconds(60)); allocator.setalloccallback(|id: &[u8]| { // }); allocator.setdealloc_callback(|id: &[u8]| { // });
let macaddress = "abcdabcdabcd".toowned(); allocator.alloctimeout(macaddress, Duration::fromseconds(3)); allocator.waitprocess_exit().await?; ```