overloadf version - 0.1.0
Overloadf
** Let function overloading possible in rust **
With a single attribute on top of the function, you can overload the function with different parameters. Current implementation still has some flaws and todo items, so use at your own risk.
This library is based on some unstable features. To use this library, please put the following lines in crate root and the beginning of test files:
There are some features that cannot be achieved until now:
- unsafe function overloading
- const function overloading
- different privacy setting on function overloading (will pickup the privacy setting in first function and apply to all)
- function overloading inside traits
Examples:
simple one:
use *;
pub unsafe
assert_eq!;
let c: &u64 = &6_u64;
assert_eq!; // unsafe function is not supported.
with generic and custom type:
use *;
use MulAssign;
use Debug;
;
let aa = 123;
assert_eq!;
assert_eq!;
async / await:
use *;
pub async
pub async
assert_eq!;
assert_eq!;
type conflict might happen if generic overlaps with the definition of implemented types:
use *;
use Mul;
use Debug;
License
Licensed under
- MIT license (LICENSE-MIT or https://opensource.org/licences/MIT)
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, shall be licensed as above, without any additional terms or conditions.