[][src]Attribute Macro track::track

#[track]

A macro attribute that indicates a type that needs to be tracked and implements Trackable and TrackableMarker.

Examples

Add track attribute to mark your struct as trackable.

// imports all necessarily types for the `track` attribute.
use track::preclude::*;

#[track]
#[derive(Debug)]
pub struct Position {
    pub x: u32,
    pub y: u32,
}

You can specify a serialization method for the track macro. Give the name of the type that implements SerializationStrategy, and make sure it is in scope for the macro. Such as:

use track::serialization::bincode::Bincode;

#[track(serialization = "Bincode")]
struct Postition ...

For a more in-depth example checkout the examples on github.