[−][src]Struct syntex_syntax2::codemap::FileMap
A single source in the CodeMap.
Fields
name: String
The name of the file that the source came from, source that doesn't
originate from files has names between angle brackets by convention,
e.g. <anon>
name_was_remapped: bool
True if the name
field above has been modified by -Zremap-path-prefix
crate_of_origin: u32
Indicates which crate this FileMap was imported from.
src: Option<Rc<String>>
The complete source code
start_pos: BytePos
The start position of this source in the CodeMap
end_pos: BytePos
The end position of this source in the CodeMap
lines: RefCell<Vec<BytePos>>
Locations of lines beginnings in the source code
multibyte_chars: RefCell<Vec<MultiByteChar>>
Locations of multi-byte characters in the source code
Methods
impl FileMap
[src]
pub fn next_line(&self, pos: BytePos)
[src]
EFFECT: register a start-of-line offset in the table of line-beginnings. UNCHECKED INVARIANT: these offsets must be added in the right order and must be in the right places; there is shared knowledge about what ends a line between this file and parse.rs WARNING: pos param here is the offset relative to start of CodeMap, and CodeMap will append a newline when adding a filemap without a newline at the end, so the safe way to call this is with value calculated as filemap.start_pos + newline_offset_relative_to_the_start_of_filemap.
pub fn get_line(&self, line_number: usize) -> Option<&str>
[src]
get a line from the list of pre-computed line-beginnings. line-number here is 0-based.
pub fn record_multibyte_char(&self, pos: BytePos, bytes: usize)
[src]
pub fn is_real_file(&self) -> bool
[src]
pub fn is_imported(&self) -> bool
[src]
pub fn byte_length(&self) -> u32
[src]
pub fn count_lines(&self) -> usize
[src]
pub fn lookup_line(&self, pos: BytePos) -> Option<usize>
[src]
Find the line containing the given position. The return value is the
index into the lines
array of this FileMap, not the 1-based line
number. If the filemap is empty or the position is located before the
first line, None is returned.
pub fn line_bounds(&self, line_index: usize) -> (BytePos, BytePos)
[src]
Trait Implementations
impl Clone for FileMap
[src]
fn clone(&self) -> FileMap
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Debug for FileMap
[src]
impl<'de> Deserialize<'de> for FileMap
[src]
fn deserialize<__D>(
__deserializer: __D
) -> Result<FileMap, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
[src]
__deserializer: __D
) -> Result<FileMap, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
impl Serialize for FileMap
[src]
fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error> where
__S: Serializer,
[src]
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error> where
__S: Serializer,
Auto Trait Implementations
impl !Sync for FileMap
impl Unpin for FileMap
impl !Send for FileMap
impl !RefUnwindSafe for FileMap
impl UnwindSafe for FileMap
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> DeserializeOwned for T where
T: Deserialize<'de>,
[src]
T: Deserialize<'de>,