Skip to content

Commit

Permalink
Removed weird examples and added syntax cues
Browse files Browse the repository at this point in the history
  • Loading branch information
ASalvail committed Sep 8, 2018
1 parent 05961c2 commit 5464ad0
Showing 1 changed file with 17 additions and 15 deletions.
32 changes: 17 additions & 15 deletions screeps-game-api/src/objects/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,21 +88,23 @@ macro_rules! impl_room_object_properties {
}


// Macro for mass implementing `StructureProperties`, `PartialEq` and `Eq` for a type.
//
// This macro accepts a comma-separated list of types on which to implement the unsafe `StructureProperties` trait on
// a screeps object.
// From that implementation, the type gets the `id` method which is used to implement `PartialEq` and `Eq`.
//
// # Example
// ```
// macro_rules!(OwnedStructure, Structure, StructureContainer)
// ```
//
// # Safety
// The macro assumes that it is implementing the trait to a valid `Reference`
// (See `reference_wrapper` macro) which will support all `StructureProperties` methods.
//
/// Macro for mass implementing `StructureProperties`, `PartialEq` and `Eq` for a type.
///
/// Macro syntax:
/// impl_structure_properties!{
/// $struct1,
/// $struct2,
/// ...
/// }
///
/// This macro accepts a comma-separated list of types on which to implement the unsafe `StructureProperties` trait on
/// a screeps object.
/// From that implementation, the type gets the `id` method which is used to implement `PartialEq` and `Eq`.
///
/// # Safety
/// The macro assumes that it is implementing the trait to a valid `Reference`
/// (See `reference_wrapper` macro) which will support all `StructureProperties` methods.
///
macro_rules! impl_structure_properties {
( $( $struct_name:ty ),+ ) => {$(
unsafe impl StructureProperties for $struct_name {}
Expand Down

0 comments on commit 5464ad0

Please sign in to comment.