shorten

Crates.ioshorten
lib.rsshorten
version0.2.0
sourcesrc
created_at2018-02-17 16:40:45.790541
updated_at2021-08-02 11:18:28.922966
descriptionA collection of convenience functions, macros and traits to shorten repetitive code.
homepagehttps://github.com/kkayal/shorten
repositoryhttps://github.com/kkayal/shorten
max_upload_size
id51605
size4,827
(kkayal)

documentation

README

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");
Commit count: 12

cargo fmt