From 2481db69b143f2474a41fcc4538b6a9c9d2e4234 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Wed, 8 Jan 2025 21:05:51 +0000 Subject: [PATCH] feat: add function and macro `s` to convert to String --- src/experimental/to_string.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/experimental/to_string.rs b/src/experimental/to_string.rs index 8337712..83ed1ff 100644 --- a/src/experimental/to_string.rs +++ b/src/experimental/to_string.rs @@ -1 +1,15 @@ // +#![allow(unused)] + +/// Converts the parameter into a [String] using the [Into] trait. +pub fn s(v: impl Into) -> String { + v.into() +} + +/// Converts the parameter into a [String] by calling `.to_string()`. +#[macro_export] +macro_rules! s { + ($value:expr) => { + $value.to_string() + }; +}