Skip to main content

SourceFile

Struct SourceFile 

Source
pub struct SourceFile(Id);

Tuple Fields§

§0: Id

Implementations§

Source§

impl SourceFile

Source

pub fn ingredient(db: &dyn Database) -> &IngredientImpl<Self>

Source

pub fn ingredient_mut( db: &mut dyn Database, ) -> (&mut IngredientImpl<Self>, &mut Runtime)

Source§

impl SourceFile

Source

pub fn new<Db_>(db: &Db_, url: Url, contents: Result<String, String>) -> Self
where Db_: ?Sized + Database,

Source

pub fn builder( url: Url, contents: Result<String, String>, ) -> <Self as HasBuilder>::Builder

Source

pub fn url<'db, Db_>(self, db: &'db Db_) -> &'db Url
where Db_: ?Sized + Database,

Source

pub fn contents<'db, Db_>(self, db: &'db Db_) -> &'db Result<String, String>
where Db_: ?Sized + Database,

Source

pub fn set_url<'db, Db_>( self, db: &'db mut Db_, ) -> impl Setter<FieldTy = Url> + 'db
where Db_: ?Sized + Database,

Source

pub fn set_contents<'db, Db_>( self, db: &'db mut Db_, ) -> impl Setter<FieldTy = Result<String, String>> + 'db
where Db_: ?Sized + Database,

Source

pub fn default_debug_fmt(this: Self, f: &mut Formatter<'_>) -> Result
where for<'__trivial_bounds> Url: Debug, for<'__trivial_bounds> Result<String, String>: Debug,

Default debug formatting for this struct (may be useful if you define your own Debug impl)

Source§

impl SourceFile

Source

pub fn contents_if_ok(self, db: &dyn Db) -> &str

Returns the contents of this file or an empty string if it couldn’t be read.

Source

pub fn absolute_span(self, db: &dyn Db) -> AbsoluteSpan

Returns an absolute span representing the entire source file.

Source

pub fn module_name(self, db: &dyn Db) -> Identifier<'_>

Source

pub fn url_display(self, db: &dyn Db) -> String

Source

pub fn line_starts(self: SourceFile, db: &dyn Db) -> &Vec<AbsoluteOffset>

A vector containing the start indices of each (0-based) line plus one final entry with the total document length (effectively an imaginary N+1 line that starts, and ends, at the end).

Source

pub fn line_range(self, db: &dyn Db, line: ZeroLine) -> Range<AbsoluteOffset>

Source

pub fn line_col( self, db: &dyn Db, offset: AbsoluteOffset, ) -> (ZeroLine, ZeroColumn)

Trait Implementations§

Source§

impl AsId for SourceFile

Source§

fn as_id(&self) -> Id

Source§

impl Clone for SourceFile

Source§

fn clone(&self) -> SourceFile

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Configuration for SourceFile

Source§

type Struct = SourceFile

The input struct (which wraps an Id)

Source§

type Fields = (Url, Result<String, String>)

A (possibly empty) tuple of the fields for this struct.

Source§

type Stamps = Array<StampedValue<()>, 2>

A array of StampedValue<()> tuples, one per each of the value fields.

Source§

const DEBUG_NAME: &'static str = "SourceFile"

Source§

const FIELD_DEBUG_NAMES: &'static [&'static str]

Source§

type Singleton = NotSingleton

The singleton state for this input if any.
Source§

impl Debug for SourceFile

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'db> From<SourceFile> for Anchor<'db>

Source§

fn from(value: SourceFile) -> Self

Converts to this type from the input type.
Source§

impl<'db> From<SourceFile> for AstItem<'db>

Source§

fn from(value: SourceFile) -> Self

Converts to this type from the input type.
Source§

impl FromId for SourceFile

Source§

fn from_id(id: Id) -> Self

Source§

impl HasBuilder for SourceFile

Source§

type Builder = Builder_

Source§

impl Hash for SourceFile

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Ord for SourceFile

Source§

fn cmp(&self, other: &SourceFile) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for SourceFile

Source§

fn eq(&self, other: &SourceFile) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for SourceFile

Source§

fn partial_cmp(&self, other: &SourceFile) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl SalsaStructInDb for SourceFile

Source§

type MemoIngredientMap = MemoIngredientSingletonIndex

Source§

fn lookup_or_create_ingredient_index(aux: &Zalsa) -> IngredientIndices

Lookup or create ingredient indices. Read more
Source§

fn cast(id: Id, type_id: TypeId) -> Option<Self>

Plumbing to support nested salsa supertypes. Read more
Source§

impl Serialize for SourceFile

Source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<'db> Spanned<'db> for SourceFile

Source§

fn span(&self, db: &'db dyn Db) -> Span<'db>

Source§

impl Update for SourceFile

Source§

unsafe fn maybe_update(old_pointer: *mut Self, new_value: Self) -> bool

Returns Read more
Source§

impl Copy for SourceFile

Source§

impl Eq for SourceFile

Source§

impl StructuralPartialEq for SourceFile

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<Q, K> Comparable<K> for Q
where Q: Ord + ?Sized, K: Borrow<Q> + ?Sized,

§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> FromIdWithDb for T
where T: FromId,

§

fn from_id(id: Id, _db: &(impl Database + ?Sized)) -> T

§

impl<T> HashEqLike<&T> for T
where T: Hash + Eq,

§

fn hash<H>(&self, h: &mut H)
where H: Hasher,

§

fn eq(&self, data: &&T) -> bool

§

impl<T> HashEqLike<T> for T
where T: Hash + Eq,

§

fn hash<H>(&self, h: &mut H)
where H: Hasher,

§

fn eq(&self, data: &T) -> bool

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
§

impl<T> Lookup<T> for T

§

fn into_owned(self) -> T

§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Serialize for T
where T: Serialize + ?Sized,

Source§

fn erased_serialize(&self, serializer: &mut dyn Serializer) -> Result<(), Error>

Source§

fn do_erased_serialize( &self, serializer: &mut dyn Serializer, ) -> Result<(), ErrorImpl>

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
Source§

impl<T> DebugArgument for T
where T: Debug,

§

impl<T> ErasedDestructor for T
where T: 'static,

§

impl<T> MaybeSendSync for T