pub enum File {
FileId(u16),
Synthetic(u16),
}Expand description
The source site containing syntax.
FileId is the ordinary source-file identity. Keeping the identity behind
an enum lets the syntax model add distinct embedded or macro hygiene sites
without changing every span and token field.
Variants§
FileId(u16)
An ordinary source file registered under a compact process-local id.
Synthetic(u16)
Syntax constructed without a corresponding on-disk source file.
Implementations§
Source§impl File
impl File
Sourcepub fn fresh() -> Self
pub fn fresh() -> Self
Allocates a compact process-local file label.
The counter may recycle after all u16 values have been used. Source
snapshot identity is carried by the shared Source allocation, so a
recycled display label cannot make unrelated spans equal or joinable.
Sourcepub const fn from_raw(raw: u16) -> Self
pub const fn from_raw(raw: u16) -> Self
Creates an identity from an application-defined integer.
Sourcepub const fn is_synthetic(self) -> bool
pub const fn is_synthetic(self) -> bool
Reports whether this identity labels syntax constructed outside an input file, whose text records no layout an author wrote.