pub struct Conditional {
pub check_type: Box<TsValue>,
pub extends_type: Box<TsValue>,
pub true_type: Box<TsValue>,
pub false_type: Box<TsValue>,
pub modifier: ConditionalModifier,
}Expand description
条件类型,表示 T extends U ? X : Y
Fields§
§check_type: Box<TsValue>检查类型 (T)
extends_type: Box<TsValue>扩展类型 (U)
true_type: Box<TsValue>真分支类型 (X)
false_type: Box<TsValue>假分支类型 (Y)
modifier: ConditionalModifier约束修饰符
Implementations§
Source§impl Conditional
impl Conditional
Sourcepub fn new(
check_type: TsValue,
extends_type: TsValue,
true_type: TsValue,
false_type: TsValue,
) -> Self
pub fn new( check_type: TsValue, extends_type: TsValue, true_type: TsValue, false_type: TsValue, ) -> Self
创建新的条件类型
Sourcepub fn with_infer(
check_type: TsValue,
extends_type: TsValue,
type_param: String,
) -> Self
pub fn with_infer( check_type: TsValue, extends_type: TsValue, type_param: String, ) -> Self
创建带有 infer 修饰符的条件类型
Sourcepub fn with_true_type(self, true_type: TsValue) -> Self
pub fn with_true_type(self, true_type: TsValue) -> Self
设置真分支类型
Sourcepub fn with_false_type(self, false_type: TsValue) -> Self
pub fn with_false_type(self, false_type: TsValue) -> Self
设置假分支类型
Trait Implementations§
Source§impl Clone for Conditional
impl Clone for Conditional
Source§fn clone(&self) -> Conditional
fn clone(&self) -> Conditional
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for Conditional
impl Debug for Conditional
Source§impl Hash for Conditional
impl Hash for Conditional
Source§impl PartialEq for Conditional
impl PartialEq for Conditional
impl Eq for Conditional
impl StructuralPartialEq for Conditional
Auto Trait Implementations§
impl Freeze for Conditional
impl !RefUnwindSafe for Conditional
impl Send for Conditional
impl Sync for Conditional
impl Unpin for Conditional
impl UnsafeUnpin for Conditional
impl !UnwindSafe for Conditional
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