[][src]Attribute Macro rudeboy::metamethods

#[metamethods]

Placed on a struct or enum definition; generates an impl of RudeboyMetamethods to add the specified metamethods to the exported user data.

Takes any combination of the following parameters:

  • Add - allows the use of the + operator. Uses std::ops::Add
  • BAnd - allows the use of the & operator. Uses std::ops::BitAnd
  • BNot - allows the use of the unary ~ operator. Uses std::ops::Not
  • BOr - allows the use of the | operator. Uses std::ops::BitOr
  • BXor - allows the use of the binary ~ operator. Uses std::ops::BitXor
  • Div - allows the use of the / operator. Uses std::ops::Div
  • Eq - allows the use of the == operator. Uses std::cmp::PartialEq
  • Index - allows the use of . to retrieve fields. Only usable for structs with named fields
  • Le - allows the use of the <= operator. Uses std::cmp::PartialOrd
  • Lt - allows the use of the < operator. Uses std::cmp::PartialOrd
  • Mod - allows the use of the % operator. Uses std::ops::Rem
  • Mul - allows the use of the * operator. Uses std::ops::Mul
  • Shl - allows the use of the << operator. Uses std::ops::Shl
  • Shr - allows the use of the >> operator. Uses std::ops::Shr
  • Sub - allows the use of the binary - operator. Uses std::ops::Sub
  • Unm - allows the use of the unary - operator. Uses std::ops::Neg

Note: all binary operators currently take a parameter of the same type as the type the metamethod is being added to. This is not obviously not ideal.