port-alloc

Crates.ioport-alloc
lib.rsport-alloc
version0.1.0
sourcesrc
created_at2020-12-06 20:03:39.857666
updated_at2020-12-06 20:03:39.857666
descriptionport allocator
homepage
repository
max_upload_size
id320218
size8,455
Cheng JIANG (GopherJ)

documentation

README

port-alloc

Installation

Add this package to Cargo.toml of your project. (Check https://crates.io/crates/port-alloc for right version)

[dependencies]
port-alloc = "0.1.0"

Get started

use port_alloc::PortAlloc;
use std::time::Duration;

let allocator = PortAlloc::new(20000, 65535, Duration::from_seconds(60));
allocator.set_alloc_callback(|id: &[u8]| {
   //
});
allocator.set_dealloc_callback(|id: &[u8]| {
   //
});

let mac_address = "abcdabcdabcd".to_owned();
allocator.alloc_timeout(mac_address, Duration::from_seconds(3));
allocator.wait_process_exit().await?;
Commit count: 0

cargo fmt