Skip to main content

ToTsString

Trait ToTsString 

Source
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§

Source

fn to_ts_string(&self) -> String

Convert this value to a TypeScript string representation.

Implementations on Foreign Types§

Source§

impl ToTsString for bool

Source§

impl ToTsString for char

Source§

impl ToTsString for f32

Source§

impl ToTsString for f64

Source§

impl ToTsString for i8

Source§

impl ToTsString for i16

Source§

impl ToTsString for i32

Source§

impl ToTsString for i64

Source§

impl ToTsString for i128

Source§

impl ToTsString for isize

Source§

impl ToTsString for str

Source§

impl ToTsString for u8

Source§

impl ToTsString for u16

Source§

impl ToTsString for u32

Source§

impl ToTsString for u64

Source§

impl ToTsString for u128

Source§

impl ToTsString for usize

Source§

impl ToTsString for String

Source§

impl<T: ToTsString + Clone> ToTsString for Cow<'_, T>

Source§

impl<T: ToTsString + ?Sized> ToTsString for &T

Source§

impl<T: ToTsString + ?Sized> ToTsString for &mut T

Source§

impl<T: ToTsString + ?Sized> ToTsString for Box<T>

Source§

impl<T: ToTsString> ToTsString for Arc<T>

Implementors§

Source§

impl ToTsString for Expr

Available on crate feature swc only.
Source§

impl ToTsString for Stmt

Available on crate feature swc only.
Source§

impl ToTsString for TsType

Available on crate feature swc only.
Source§

impl ToTsString for TsStream

Available on crate feature swc only.
Source§

impl ToTsString for Ident

Available on crate feature swc only.
Source§

impl<T: ToTsString> ToTsString for Rc<T>