pub struct SourceFile(/* private fields */);Expand description
A single source file tracked by the incremental database.
Fields:
source— raw UTF-8 source text.dialect— parsing dialect (spec §9).options_digest— hash of analysis options. Full shape deferred to bead cy-nk7; zero is a valid “no options” value.precomputed_parse— optional pre-computedParseOutput(cy-li6). WhenSome,super::parse_cstreturns this value directly instead of re-parsingsourcefrom scratch. Set bysuper::workspace::Database::edit_fileafter the smart-path sub-tree splice produces a freshsuper::Parse; cleared on every non-incremental source mutation (set_source,update_file).
Implementations§
Source§impl SourceFile
impl SourceFile
pub fn ingredient(db: &(dyn Database + 'static)) -> &IngredientImpl<SourceFile>
pub fn ingredient_mut( zalsa_mut: &mut Zalsa, ) -> (&mut IngredientImpl<SourceFile>, &mut Runtime)
Source§impl SourceFile
impl SourceFile
pub fn new<Db_>( db: &Db_, source: String, dialect: DialectMode, options_digest: u64, precomputed_parse: Option<ParseOutput>, ) -> SourceFile
pub fn builder( source: String, dialect: DialectMode, options_digest: u64, precomputed_parse: Option<ParseOutput>, ) -> <SourceFile as HasBuilder>::Builder
Sourcepub fn source<Db_, 'db>(self, db: &'db Db_) -> &'db String
pub fn source<Db_, 'db>(self, db: &'db Db_) -> &'db String
Raw UTF-8 source text for this file.
Sourcepub fn dialect<Db_, 'db>(self, db: &'db Db_) -> DialectMode
pub fn dialect<Db_, 'db>(self, db: &'db Db_) -> DialectMode
Dialect used when parsing this file.
Sourcepub fn options_digest<Db_, 'db>(self, db: &'db Db_) -> u64
pub fn options_digest<Db_, 'db>(self, db: &'db Db_) -> u64
Hash of options that affect derived queries. Shape is stabilised in cy-nk7; zero is a valid “no options” value.
Sourcepub fn precomputed_parse<Db_, 'db>(
self,
db: &'db Db_,
) -> &'db Option<ParseOutput>
pub fn precomputed_parse<Db_, 'db>( self, db: &'db Db_, ) -> &'db Option<ParseOutput>
Optional pre-computed parse, supplied by the incremental edit
path (cy-li6). None means “no hint, re-parse source”.
pub fn set_source<Db_, 'db>( self, db: &'db mut Db_, ) -> impl Setter<FieldTy = String> + use<'db, Db_>
pub fn set_dialect<Db_, 'db>( self, db: &'db mut Db_, ) -> impl Setter<FieldTy = DialectMode> + use<'db, Db_>
pub fn set_options_digest<Db_, 'db>( self, db: &'db mut Db_, ) -> impl Setter<FieldTy = u64> + use<'db, Db_>
pub fn set_precomputed_parse<Db_, 'db>( self, db: &'db mut Db_, ) -> impl Setter<FieldTy = Option<ParseOutput>> + use<'db, Db_>
Sourcepub fn default_debug_fmt(
this: SourceFile,
f: &mut Formatter<'_>,
) -> Result<(), Error>where
String: for<'__trivial_bounds> Debug,
DialectMode: for<'__trivial_bounds> Debug,
u64: for<'__trivial_bounds> Debug,
Option<ParseOutput>: for<'__trivial_bounds> Debug,
pub fn default_debug_fmt(
this: SourceFile,
f: &mut Formatter<'_>,
) -> Result<(), Error>where
String: for<'__trivial_bounds> Debug,
DialectMode: for<'__trivial_bounds> Debug,
u64: for<'__trivial_bounds> Debug,
Option<ParseOutput>: for<'__trivial_bounds> Debug,
Default debug formatting for this struct (may be useful if you define your own Debug impl)
Trait Implementations§
Source§impl Clone for SourceFile
impl Clone for SourceFile
Source§fn clone(&self) -> SourceFile
fn clone(&self) -> SourceFile
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Hash for SourceFile
impl Hash for SourceFile
Source§impl PartialEq for SourceFile
impl PartialEq for SourceFile
Source§fn eq(&self, other: &SourceFile) -> bool
fn eq(&self, other: &SourceFile) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Update for SourceFile
impl Update for SourceFile
Source§unsafe fn maybe_update(
old_pointer: *mut SourceFile,
new_value: SourceFile,
) -> bool
unsafe fn maybe_update( old_pointer: *mut SourceFile, new_value: SourceFile, ) -> bool
Returns Read more
impl Copy for SourceFile
impl Eq for SourceFile
impl StructuralPartialEq for SourceFile
Auto Trait Implementations§
impl Freeze for SourceFile
impl RefUnwindSafe for SourceFile
impl Send for SourceFile
impl Sync for SourceFile
impl Unpin for SourceFile
impl UnsafeUnpin for SourceFile
impl UnwindSafe for SourceFile
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<T> HashEqLike<&T> for T
impl<T> HashEqLike<&T> for T
Source§impl<T> HashEqLike<Cow<'_, T>> for T
impl<T> HashEqLike<Cow<'_, T>> for T
Source§impl<T> HashEqLike<T> for T
impl<T> HashEqLike<T> for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more