Skip to content

Latest commit

History

15 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

LicenseCargoDocumentation

Macros for repeating implementations with type substitutions.

Example

Before:

macro_rules! itoa_into_bytes {($t:ty) => {implIntoBytesfor $t {fn into_bytes(self) -> Vec<u8> {letmut buf = ::itoa::Buffer::new();let s = buf.format(self);
s.as_bytes().to_vec()}}};}itoa_into_bytes!(i8);itoa_into_bytes!(u8);itoa_into_bytes!(i16);itoa_into_bytes!(u16);itoa_into_bytes!(i32);itoa_into_bytes!(u32);itoa_into_bytes!(i64);itoa_into_bytes!(u64);itoa_into_bytes!(isize);itoa_into_bytes!(usize);

After:

#[impl_for_each(i8,u8,i16,u16,i32,u32,i64,isize,usize)]implIntoBytesforT{fninto_bytes(self) -> Vec<u8>{letmut buf = ::itoa::Buffer::new();let s = buf.format(self);
s.as_bytes().to_vec()}}

About

A proc macro to impl for multiple types

Resources

Stars

9 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages