pub enum TypedChainPart {
Field {
name: Ident,
optional: bool,
result_ty: Type,
span: Span,
},
InterfaceProperty {
iface: MangledName,
name: Ident,
optional: bool,
result_ty: Type,
span: Span,
},
Index {
idx: ExprId,
optional: bool,
result_ty: Type,
span: Span,
},
Call {
args: Vec<ExprId>,
optional: bool,
result_ty: Type,
span: Span,
},
MethodCall {
iface: MangledName,
name: Ident,
args: Vec<ExprId>,
optional: bool,
result_ty: Type,
span: Span,
},
NonNull {
result_ty: Type,
span: Span,
},
}Expand description
optional drives short-circuit codegen; result_ty is the type after this part, without | null.
Variants§
Field
InterfaceProperty
Index
Call
MethodCall
NonNull
! applied to the step before it. A runtime-checked narrowing that throws
TypeError on null, matching the non-chain NonNullAssert — not TS’s
unchecked assertion.
Implementations§
Source§impl TypedChainPart
impl TypedChainPart
Sourcepub fn set_result_ty(&mut self, ty: Type)
pub fn set_result_ty(&mut self, ty: Type)
Replaces the type this step yields. Used when a chain step’s path turns out to be narrowed: the step reads at the narrowed type, not the declared one, and the next step’s receiver follows.
Sourcepub fn is_optional(&self) -> bool
pub fn is_optional(&self) -> bool
Whether this step short-circuits on a null receiver (?.).
Trait Implementations§
Source§impl Clone for TypedChainPart
impl Clone for TypedChainPart
Source§impl Debug for TypedChainPart
impl Debug for TypedChainPart
Source§impl PartialEq for TypedChainPart
impl PartialEq for TypedChainPart
impl StructuralPartialEq for TypedChainPart
Auto Trait Implementations§
impl Freeze for TypedChainPart
impl RefUnwindSafe for TypedChainPart
impl Send for TypedChainPart
impl Sync for TypedChainPart
impl Unpin for TypedChainPart
impl UnsafeUnpin for TypedChainPart
impl UnwindSafe for TypedChainPart
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