ev3dev-lang-rust-derive

Crates.ioev3dev-lang-rust-derive
lib.rsev3dev-lang-rust-derive
version0.10.0
sourcesrc
created_at2019-12-08 09:43:37.938924
updated_at2021-02-02 13:02:34.897455
descriptionDerive macros for ev3dev_lang_rust
homepage
repositoryhttps://github.com/pixix4/ev3dev-lang-rust
max_upload_size
id187261
size3,270
Lars Westermann (pixix4)

documentation

README

Derive macros for ev3dev_lang_rust

Build Status Latest version

This crate provides some derive macros to simplify the codebase.

The following traits can be automatically derived:

  • Device
  • Findable
  • Motor
  • TachoMotor
  • ServoMotor
  • DcMotor
  • Sensor

The findable derive needs 3 additional attributes.

  • class_name: &str
  • driver_name: &str
  • port: dyn ev3dev_lang_rust::Motor

Example

The functionallity of the LargeMotor struct consists complitly through derives:

#[derive(Debug, Clone, Device, Findable, Motor, TachoMotor)]
#[class_name = "tacho-motor"]
#[driver_name = "lego-ev3-l-motor"]
#[port = "crate::motors::MotorPort"]
pub struct LargeMotor {
    driver: Driver,
}
Commit count: 84

cargo fmt