#macros #functions #traits

shorten

A collection of convenience functions, macros and traits to shorten repetitive code

6 releases

0.2.0 Aug 2, 2021
0.1.5 Jan 21, 2019
0.1.3 Feb 19, 2018

#514 in Rust patterns

Download history 7/week @ 2022-02-21 28/week @ 2022-03-14 21/week @ 2022-03-21 37/week @ 2022-04-25 55/week @ 2022-05-02 6/week @ 2022-05-09

98 downloads per month

MIT license

4KB

Objective:

A collection of convenience functions, macros and traits to shorten repetitive code.

Status

passively-maintained

Version

0.2

Example 1:

Shorten the conversion to a String.

s!("Hello") is the same as String::from("Hello"))

Example 2:

Concatenate two string(s) (slices) and return a string slice.

ss!("Hello", ", world") is the same as "Hello, world";

The same macro works also with an arbitrary combination of String objects and string slices

#[macro_use] extern crate shorten;
use shorten::*;
let s1 = s!("Hello");
let s2 = s!(", world");
assert_eq!(ss!(s1, s2), "Hello, world");

Example 3:

// #[macro_use] extern crate shorten;

#[macro_use] extern crate shorten;
use shorten::*;
let s1 = s!("Hello");
let s2 = s!(", world");
assert_eq!(ss!(s1, s2), "Hello, world");

lib.rs:

Objective:

A collection of convenience functions, macros and traits to shorten repetitive code.

Status

passively-maintained

Version

0.2

Example 1:

Shorten the conversion to a String.

s!("Hello") is the same as String::from("Hello"))

Example 2:

Concatenate two string(s) (slices) and return a string slice.

ss!("Hello", ", world") is the same as "Hello, world";

The same macro works also with an arbitrary combination of String objects and string slices

#[macro_use] extern crate shorten;
use shorten::*;
let s1 = s!("Hello");
let s2 = s!(", world");
assert_eq!(ss!(s1, s2), "Hello, world");

No runtime deps