pub struct FileText(/* private fields */);Expand description
The VFS leaf: one file’s UTF-8 text, as a salsa input, plus its FileId (so a query
holding only a FileText can recover the id for cross-file resolution) and its res://
path (so preload/extends "res://…" resolve to the declaring file — M3).
res_path is a separate salsa input field from text: salsa tracks input fields
individually (per-field revisions/durabilities — verified against salsa 0.27.1
input.rs), so a query reading only res_path (the res_path_registry) backdates across
a text keystroke — exactly the firewall that protects file_class_name. It is held at
MEDIUM durability (set on file add, stable across edits); text stays LOW.
Implementations§
Source§impl FileText
impl FileText
pub fn ingredient(db: &dyn Database) -> &IngredientImpl<Self>
pub fn ingredient_mut( zalsa_mut: &mut Zalsa, ) -> (&mut IngredientImpl<Self>, &mut Runtime)
Source§impl FileText
impl FileText
pub fn new<Db_>( db: &Db_, text: Arc<str>, file_id: FileId, res_path: Option<SmolStr>, ) -> Self
pub fn builder( text: Arc<str>, file_id: FileId, res_path: Option<SmolStr>, ) -> <Self as HasBuilder>::Builder
Sourcepub fn text<'db, Db_>(self, db: &'db Db_) -> &'db Arc<str>
pub fn text<'db, Db_>(self, db: &'db Db_) -> &'db Arc<str>
The file’s full text (interned Arc<str>; the getter returns &Arc<str>).
Sourcepub fn file_id<'db, Db_>(self, db: &'db Db_) -> FileId
pub fn file_id<'db, Db_>(self, db: &'db Db_) -> FileId
The opaque file id this text belongs to.
Sourcepub fn res_path<'db, Db_>(self, db: &'db Db_) -> Option<SmolStr>
pub fn res_path<'db, Db_>(self, db: &'db Db_) -> Option<SmolStr>
The file’s project-relative res:// path, if the loader supplied one (None in
single-file mode / tests — then preload/extends "res://…" resolve to the seam).
pub fn set_text<'db, Db_>( self, db: &'db mut Db_, ) -> impl Setter<FieldTy = Arc<str>>
pub fn set_file_id<'db, Db_>( self, db: &'db mut Db_, ) -> impl Setter<FieldTy = FileId>
pub fn set_res_path<'db, Db_>( self, db: &'db mut Db_, ) -> impl Setter<FieldTy = Option<SmolStr>>
Trait Implementations§
Source§impl Configuration for FileText
impl Configuration for FileText
const LOCATION: Location
const DEBUG_NAME: &'static str = "FileText"
const FIELD_DEBUG_NAMES: &'static [&'static str]
Source§type Fields = (Arc<str>, FileId, Option<SmolStr>)
type Fields = (Arc<str>, FileId, Option<SmolStr>)
Source§type Durabilities = [Durability; 3]
type Durabilities = [Durability; 3]
persistence only.Source§fn serialize<S: Serializer>(
fields: &Self::Fields,
serializer: S,
) -> Result<S::Ok, S::Error>
fn serialize<S: Serializer>( fields: &Self::Fields, serializer: S, ) -> Result<S::Ok, S::Error>
serde. Read moreSource§fn deserialize<'de, D: Deserializer<'de>>(
deserializer: D,
) -> Result<Self::Fields, D::Error>
fn deserialize<'de, D: Deserializer<'de>>( deserializer: D, ) -> Result<Self::Fields, D::Error>
serde. Read moreimpl Copy for FileText
impl Eq for FileText
Source§impl SalsaStructInDb for FileText
impl SalsaStructInDb for FileText
Source§const LEAF_TYPE_IDS: &'static [ConstTypeId]
const LEAF_TYPE_IDS: &'static [ConstTypeId]
type MemoIngredientMap = MemoIngredientSingletonIndex
Source§fn lookup_ingredient_index(aux: &Zalsa) -> IngredientIndices
fn lookup_ingredient_index(aux: &Zalsa) -> IngredientIndices
Source§fn entries(zalsa: &Zalsa) -> impl Iterator<Item = DatabaseKeyIndex> + '_
fn entries(zalsa: &Zalsa) -> impl Iterator<Item = DatabaseKeyIndex> + '_
impl StructuralPartialEq for FileText
Auto Trait Implementations§
impl Freeze for FileText
impl RefUnwindSafe for FileText
impl Send for FileText
impl Sync for FileText
impl Unpin for FileText
impl UnsafeUnpin for FileText
impl UnwindSafe for FileText
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
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
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§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
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> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.