pub trait Method: Method { }
Expand description
Trait implemented for function pointers that can be registed as Ruby methods.
While it is possible to directly write functions that will automatically
implement this trait it is not recommended, as those functions will not
have the type conversions or error handling usually provided by this
library. See the method
and
function
macros for converting functions to an
implementor of this trait.
This trait is implimented for the following function signatures:
Arity | Signature |
---|---|
-2 | unsafe extern "C" fn(Value, RArray) -> Value; |
-1 | unsafe extern "C" fn(c_int, *const Value, Value) -> Value; |
0 | unsafe extern "C" fn(Value) -> Value; |
1 | unsafe extern "C" fn(Value, Value) -> Value; |
2 | unsafe extern "C" fn(Value, Value, Value) -> Value; |
… | … |
16 | … |
note: for arity 0..=16 the number of arguments is 1 greater than the arity,
due to the initial self
argument.