pub struct TextStorage { /* private fields */ }

Implementations§

Add a file to the database, returning the handle that can be used to refer to it again.

Get the file corresponding to the given id.

The source code of a file.

The index of the line at the given byte index. If the byte index is past the end of the file, returns the maximum line index in the file. This means that this function only fails if the file is not present.

Note for trait implementors

This can be implemented efficiently by performing a binary search over a list of line starts that was computed by calling the line_starts function that is exported from the errors module. It might be useful to pre-compute and cache these line starts.

The user-facing line number at the given line index. It is not necessarily checked that the specified line index is actually in the file.

Note for trait implementors

This is usually 1-indexed from the beginning of the file, but can be useful for implementing something like the C preprocessor’s #line macro.

The user-facing column number at the given line index and byte index.

Note for trait implementors

This is usually 1-indexed from the the start of the line. A default implementation is provided, based on the column_index function that is exported from the errors module.

Convenience method for returning line and column number at the given byte index in the file.

The byte range of line in the source of the file.

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
The error type produced by a failed conversion.
Convert the given value into an approximately equivalent representation.
The error type produced by a failed conversion.
Convert the subject into an approximately equivalent representation.
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
Approximate the subject with the default scheme.
Approximate the subject with a specific scheme.
Approximate the subject to a given type with the default scheme.
Approximate the subject to a given type with a specific scheme.
Convert the subject to a given type.
Attempt to convert the subject to a given type.
Attempt a value conversion of the subject to a given type.

Returns the argument unchanged.

Calls U::from(self).

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

The alignment of pointer.
The type for initializers.
Initializes a with the given initializer. Read more
Dereferences the given pointer. Read more
Mutably dereferences the given pointer. Read more
Drops the object pointed to by the given pointer. Read more
Read this value from the supplied reader. Same as ReadEndian::read_from_little_endian().
Read this value from the supplied reader. Same as ReadEndian::read_from_big_endian().
Read this value from the supplied reader. Same as ReadEndian::read_from_native_endian().
Should always be Self
Sets value as a parameter of self.
The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Checks if self is actually part of its subset T (and can be converted to it).
Use with care! Same as self.to_subset but without any property checks. Always succeeds.
The inclusion map: converts self to the equivalent element of its superset.
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The error type produced by a failed conversion.
Convert the given value into the subject type.
The type returned in the event of a conversion error.
Performs the conversion.
The error type produced by a failed conversion.
Convert the subject into the destination type.
The type returned in the event of a conversion error.
Performs the conversion.
The error type produced by a failed conversion.
Convert the given value into an exactly equivalent representation.
The error type produced by a failed conversion.
Convert the subject into an exactly equivalent representation.