Struct lang_util::located::LocatedBuilder

source ·
pub struct LocatedBuilder {
    pos: TextRange,
    current_file: Option<FileId>,
    path: Option<PathBuf>,
    file_override: FileOverride,
    line_number: u32,
    column: u32,
}
Expand description

Builder for a Located struct

Fields§

§pos: TextRange

Position at which the error occurred

§current_file: Option<FileId>

File identifier for the error

§path: Option<PathBuf>

Path corresponding to the file identifier

§file_override: FileOverride

Overriden file location

§line_number: u32

Resolved line number

§column: u32

Resolved column number

Implementations§

source§

impl LocatedBuilder

source

pub fn new() -> Self

Create a new builder for Located with default values

source

pub fn pos(self, pos: impl Into<TextRange>) -> Self

Set the raw position

source

pub fn current_file(self, file: impl Into<FileId>) -> Self

Set the file identifier

source

pub fn path(self, path: impl Into<PathBuf>) -> Self

Set the source path

source

pub fn file_override(self, file_override: impl Into<FileOverride>) -> Self

Set the source file override

source

pub fn line_number(self, line_number: u32) -> Self

Set the resolved line number

source

pub fn column(self, column: u32) -> Self

Set the resolved column number

source

pub fn resolve(self, resolver: &impl Resolver) -> Self

Resolve the raw offset (see LocatedBuilder::pos) to line and column information

source

pub fn resolve_file(self, resolver: &(impl Resolver + HasFileNumber)) -> Self

Resolve the raw offset (see LocatedBuilder::pos) to line and column information, and set the current file information

source

pub fn resolve_path(self, resolver: &impl FileIdResolver) -> Self

Resolve the given file id into a path name, and store it in this builder

source

pub fn finish<E>(self, inner: E) -> Located<E>

Build the final Located object from the given inner object

Trait Implementations§

source§

impl Default for LocatedBuilder

source§

fn default() -> LocatedBuilder

Returns the “default value” for a type. Read more

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> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

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, 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.