generic-to

Crates.iogeneric-to
lib.rsgeneric-to
version1.0.1
created_at2025-10-27 16:09:35.128646+00
updated_at2025-10-27 16:11:05.228255+00
descriptionmethod-generic conversion traits
homepage
repositoryhttps://github.com/flippette/generic-to
max_upload_size
id1903193
size6,096
(flippette)

documentation

README

generic-to

method-generic conversion traits.

example

use generic_to::*;

// instead of this
let one = <u16 as Into<u32>>::into(1);

// you can do this
let one = 1_u16.to::<u32>();

with the nightly feature enabled, all of these traits can also be used in const contexts.

#![feature(const_trait_impl)]

# #[cfg(feature = "nightly")]
# mod nightly {
use generic_to::*;

// this is available now
const ONE: u32 = 1_u16.to();
# }
Commit count: 0

cargo fmt