crates.io docs.rs license

turbonone (no_std)

Tiny macro for calling functions with generic Option<T> arguments.

Usage

Add to your Cargo.toml file:

toml [dependencies] turbonone = "0.*"

The Problem

```rust fn my_function(arg: Option) -> &'static str { "Works!" }

fn myboxfunction(arg: Option>) -> &'static str { "Works!" }

fn mycomplexfunction(arg: Option>>) -> &'static str { "Works!" }

myfunction(None); // cannot infer type for type parameter T declared on the associated function my_function myfunction(Some("An argument")); // Works!

myboxfunction(None); // cannot infer type for type parameter T declared on the associated function my_box_function myboxfunction(Some(Box::new("An argument"))); // Works!

mycomplexfunction(None); // cannot infer type for type parameter T declared on the associated function my_complex_function mycomplexfunction(Some(Arc::new(Box::new("An argument")))); // Works! ```

The Solution

```rust

[macro_use] extern crate turbonone;

fn my_function(arg: Option) -> &'static str { "Works!" }

fn myboxfunction(arg: Option>) -> &'static str { "Works!" }

fn mycomplexfunction(arg: Option>>) -> &'static str { "Works!" }

myfunction(turbonone!()); // Works! myfunction(Some("An argument")); // Works!

myboxfunction(turbonone!(Box)); // Works! myboxfunction(turbonone!(Box<()>)); // Works! myboxfunction(Some(Box::new("An argument"))); // Works!

mycomplexfunction(turbonone!(Arccomplexfunction(Some(Arc::new(Box::new("An argument")))); // Works! ```