pub enum SegType<'s> {
Present,
Optional,
Map(&'s str),
OptMap(&'s str),
Unknown,
}Expand description
段取到的值的类型。
Variants§
Present
一定有值(JSDoc 里非可选)
Optional
可空:数据里可能缺键,或显式 null
Map(&'s str)
Object.<string, T> 字典,&str 是元素类型原文(用于检查是否混合类型)
OptMap(&'s str)
可空字典 Object.<string, T>|null:访问语义同 SegType::Map,
但容器可空,后续非可选访问要以 E_NONOPT_ON_OPTIONAL 报错。
单独成态是因为 Map 的可空性不能丢:丢了就等于放过一次真实的 TypeError。
Unknown
推断不出:按“必有值“处理,且不因可空性报错
Implementations§
Trait Implementations§
impl<'s> Copy for SegType<'s>
impl<'s> Eq for SegType<'s>
impl<'s> StructuralPartialEq for SegType<'s>
Auto Trait Implementations§
impl<'s> Forget for SegType<'s>
impl<'s> Freeze for SegType<'s>
impl<'s> Move for SegType<'s>
impl<'s> RefUnwindSafe for SegType<'s>
impl<'s> Send for SegType<'s>
impl<'s> Sync for SegType<'s>
impl<'s> Unpin for SegType<'s>
impl<'s> UnsafeUnpin for SegType<'s>where
&'s str: UnsafeUnpin,
impl<'s> UnwindSafe for SegType<'s>where
&'s str: UnwindSafe,
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