#![cfg_attr(docsrs, feature(doc_cfg))]
#![deny(missing_docs)]
#![cfg_attr(not(feature = "std"), no_std)]
extern crate self as stringz;
#[doc(hidden)]
pub use stringz_macros::{ident as ident_inner, string as string_inner};
#[doc(hidden)]
pub use tuplez as __tuplez;
#[macro_export]
macro_rules! string {
($($t:tt)*) => {
$crate::string_inner!($crate; $($t)*)
};
}
#[macro_export]
macro_rules! ident {
($($t:tt)*) => {
$crate::ident_inner!($crate; $($t)*)
};
}
#[cfg(all(not(feature = "std"), feature = "alloc"))]
extern crate alloc;
#[cfg(all(not(feature = "std"), feature = "alloc"))]
use alloc::{
format,
string::{String, ToString},
};
#[derive(Debug, Default, Copy, Clone, PartialEq, Eq, Hash)]
pub struct Character<const C: char>;
pub trait TypedString {
#[cfg(any(feature = "std", feature = "alloc"))]
#[cfg_attr(docsrs, doc(cfg(any(feature = "std", feature = "alloc"))))]
fn value() -> String;
}
impl<const C: char> TypedString for __tuplez::Tuple<Character<C>, __tuplez::Unit> {
#[cfg(any(feature = "std", feature = "alloc"))]
fn value() -> String {
C.to_string()
}
}
impl<const C: char, Other> TypedString for __tuplez::Tuple<Character<C>, Other>
where
Other: TypedString,
{
#[cfg(any(feature = "std", feature = "alloc"))]
fn value() -> String {
format!("{}{}", C, Other::value())
}
}
#[macro_export]
macro_rules! concatstr {
($t:ty) => {
$t
};
($t:ty, $($ts:ty),*) => {
<$t as $crate::__tuplez::TupleLike>::JoinOutput<$crate::concatstr!($($ts),*)>
};
}