pub enum TsValue {
Show 19 variants
Undefined,
Null,
Boolean(bool),
Number(f64),
String(String),
Object(Vec<(String, TsValue)>),
Array(Vec<TsValue>),
Function(Rc<dyn Fn(&[TsValue]) -> TsValue>),
Error(String),
Union(Vec<TsValue>),
Generic(String, Vec<TsValue>),
Symbol(String),
BigInt(i128),
Date(i64),
RegExp(String),
Map(Vec<(TsValue, TsValue)>),
Set(Vec<TsValue>),
Promise(Box<TsValue>),
Iterable(Box<dyn Iterator<Item = TsValue>>),
}Expand description
TypeScript 值类型枚举
Variants§
Undefined
未定义
Null
空值
Boolean(bool)
布尔值
Number(f64)
数字
String(String)
字符串
Object(Vec<(String, TsValue)>)
对象
Array(Vec<TsValue>)
数组
Function(Rc<dyn Fn(&[TsValue]) -> TsValue>)
函数
Error(String)
错误
Union(Vec<TsValue>)
联合类型
Generic(String, Vec<TsValue>)
泛型类型
Symbol(String)
符号
BigInt(i128)
大整数
Date(i64)
日期
RegExp(String)
正则表达式
Map(Vec<(TsValue, TsValue)>)
Map
Set(Vec<TsValue>)
Set
Promise(Box<TsValue>)
Promise
Iterable(Box<dyn Iterator<Item = TsValue>>)
可迭代对象
Implementations§
Source§impl TsValue
impl TsValue
Sourcepub fn is_undefined(&self) -> bool
pub fn is_undefined(&self) -> bool
检查是否为未定义
Sourcepub fn is_boolean(&self) -> bool
pub fn is_boolean(&self) -> bool
检查是否为布尔值
Sourcepub fn is_function(&self) -> bool
pub fn is_function(&self) -> bool
检查是否为函数
Sourcepub fn is_generic(&self) -> bool
pub fn is_generic(&self) -> bool
检查是否为泛型类型
Sourcepub fn is_promise(&self) -> bool
pub fn is_promise(&self) -> bool
检查是否为 Promise
Sourcepub fn is_iterable(&self) -> bool
pub fn is_iterable(&self) -> bool
检查是否为可迭代对象
Sourcepub fn to_boolean(&self) -> bool
pub fn to_boolean(&self) -> bool
转换为布尔值
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TsValue
impl !RefUnwindSafe for TsValue
impl !Send for TsValue
impl !Sync for TsValue
impl Unpin for TsValue
impl UnsafeUnpin for TsValue
impl !UnwindSafe for TsValue
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more