13 releases (5 major breaking)

5.0.0 Jan 22, 2024
4.1.1 Jan 15, 2024
4.1.0 Oct 3, 2023
3.0.0 Sep 10, 2023
0.1.0 May 10, 2022

#38 in #dos

Download history 49/week @ 2023-11-27 47/week @ 2023-12-04 38/week @ 2023-12-11 34/week @ 2023-12-18 23/week @ 2023-12-25 22/week @ 2024-01-08 83/week @ 2024-01-15 65/week @ 2024-01-22 32/week @ 2024-01-29 25/week @ 2024-02-05 23/week @ 2024-02-12 73/week @ 2024-02-19 151/week @ 2024-02-26 54/week @ 2024-03-04 45/week @ 2024-03-11

328 downloads per month
Used in 21 crates (3 directly)

MIT license

12KB
241 lines

Derive macro for dos-actors UniqueIdentifier trait


lib.rs:

UID

A derive macro that implements the UniqueIdentifier trait.

Examples

Setting the data type and port # to the default values: Vec<f64> and 50_000u32, respectively:

use interface::UID;

#[derive(UID)]
enum Tag {}

The data type and port # are set with:

use interface::UID;

struct Q<T>(std::marker::PhantomData<T>);

enum ID {}

#[derive(UID)]
#[uid(data = Q<ID>, port = 9999)]
enum TU {}

An alias is a type that implements the Read, Write or Size trait of another type that implements the same traits for the same client:

use interface::{UID, Data, Read, Size, Update, Write};

struct Client {}
impl Update for Client {}
impl Write<TU> for Client {
fn write(&mut self) -> Option<Data<TU>> {
None
}
}
impl Read<TU> for Client {
fn read(&mut self, _data: Data<TU>) {}
}
impl Size<TU> for Client {
fn len(&self) -> usize {
1234
}
}

#[derive(UID)]
#[alias(name = TU, client = Client, traits = Write, Read, Size)]
enum TUT {}

Dependencies

~300–750KB
~18K SLoC