pub trait ToTsString {
// Required method
fn to_ts_string(&self) -> String;
}Expand description
Trait for converting values to TypeScript string representations.
This trait is used by ts_template! macro for interpolating values into
string-based templates. It provides a unified way to convert both standard
Rust types and SWC AST types to their TypeScript string form.
§Implementations
- Primitive types (
String,&str, numbers,bool) use their standard string representation - SWC AST types (
Expr,Ident,TsType,Stmt) use the appropriate emit functions - Wrapper types (
TsExpr,TsIdent, etc.) delegate to their inner type
Required Methods§
Sourcefn to_ts_string(&self) -> String
fn to_ts_string(&self) -> String
Convert this value to a TypeScript string representation.
Implementations on Foreign Types§
Source§impl ToTsString for bool
impl ToTsString for bool
fn to_ts_string(&self) -> String
Source§impl ToTsString for char
impl ToTsString for char
fn to_ts_string(&self) -> String
Source§impl ToTsString for f32
impl ToTsString for f32
fn to_ts_string(&self) -> String
Source§impl ToTsString for f64
impl ToTsString for f64
fn to_ts_string(&self) -> String
Source§impl ToTsString for i8
impl ToTsString for i8
fn to_ts_string(&self) -> String
Source§impl ToTsString for i16
impl ToTsString for i16
fn to_ts_string(&self) -> String
Source§impl ToTsString for i32
impl ToTsString for i32
fn to_ts_string(&self) -> String
Source§impl ToTsString for i64
impl ToTsString for i64
fn to_ts_string(&self) -> String
Source§impl ToTsString for i128
impl ToTsString for i128
fn to_ts_string(&self) -> String
Source§impl ToTsString for isize
impl ToTsString for isize
fn to_ts_string(&self) -> String
Source§impl ToTsString for str
impl ToTsString for str
fn to_ts_string(&self) -> String
Source§impl ToTsString for u8
impl ToTsString for u8
fn to_ts_string(&self) -> String
Source§impl ToTsString for u16
impl ToTsString for u16
fn to_ts_string(&self) -> String
Source§impl ToTsString for u32
impl ToTsString for u32
fn to_ts_string(&self) -> String
Source§impl ToTsString for u64
impl ToTsString for u64
fn to_ts_string(&self) -> String
Source§impl ToTsString for u128
impl ToTsString for u128
fn to_ts_string(&self) -> String
Source§impl ToTsString for usize
impl ToTsString for usize
fn to_ts_string(&self) -> String
Source§impl ToTsString for String
impl ToTsString for String
fn to_ts_string(&self) -> String
Source§impl<T: ToTsString + Clone> ToTsString for Cow<'_, T>
impl<T: ToTsString + Clone> ToTsString for Cow<'_, T>
fn to_ts_string(&self) -> String
Source§impl<T: ToTsString + ?Sized> ToTsString for &T
impl<T: ToTsString + ?Sized> ToTsString for &T
fn to_ts_string(&self) -> String
Source§impl<T: ToTsString + ?Sized> ToTsString for &mut T
impl<T: ToTsString + ?Sized> ToTsString for &mut T
fn to_ts_string(&self) -> String
Source§impl<T: ToTsString + ?Sized> ToTsString for Box<T>
impl<T: ToTsString + ?Sized> ToTsString for Box<T>
fn to_ts_string(&self) -> String
Source§impl<T: ToTsString> ToTsString for Arc<T>
impl<T: ToTsString> ToTsString for Arc<T>
fn to_ts_string(&self) -> String
Implementors§
impl ToTsString for Expr
Available on crate feature
swc only.impl ToTsString for Stmt
Available on crate feature
swc only.impl ToTsString for TsType
Available on crate feature
swc only.impl ToTsString for TsStream
Available on crate feature
swc only.impl ToTsString for Ident
Available on crate feature
swc only.