#[unimpl]

CI Crates.io

Better unimplemented! macro for function definitions.

This macro helps you iterate faster on your codebase giving you more accurate feedback on which functions were called during tests. It's most useful during development.

Without unimpl the exact reason needs to be specified explicitly otherwise the error message is too generic:

```rust use panicmessage::panicmessage;

fn func(a: u32) -> u32 { unimplemented!(); }

let error = std::panic::catchunwind(|| { func(42); }).unwraperr();

// in a bigger codebase it's not clear which function was called asserteq!(panicmessage(&error), "not implemented"); ```

With unimpl the function name is automatically attached to the error message and the function body can be completely omitted:

```rust use unimpl::unimpl; use panicmessage::panicmessage;

[unimpl]

pub fn func(a: u32) -> u32; // function body is autogenerated

let error = std::panic::catchunwind(|| { func(42); }).unwraperr();

// function name is automatically appended asserteq!(panicmessage(&error), "not implemented: func"); ```

The macro can also be used inside impl blocks:

```rust use unimpl::unimpl; use panicmessage::panicmessage;

struct X;

impl X { /// This is a func. #[unimpl] pub fn func(a: u32) -> u32; }

let error = std::panic::catchunwind(|| { X::func(42); }).unwraperr();

asserteq!(panicmessage(&error), "not implemented: func"); ```

License

This project is licensed under either of:

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this crate by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.