pub struct Source {
pub identifier: SourceIdentifier,
pub path: Option<PathBuf>,
pub content: StringIdentifier,
pub size: usize,
pub lines: Vec<usize>,
}Expand description
Represents a source file.
Fields§
§identifier: SourceIdentifier§path: Option<PathBuf>§content: StringIdentifier§size: usize§lines: Vec<usize>Implementations§
Source§impl Source
Methods for Source.
impl Source
Methods for Source.
Sourcepub fn standalone(
interner: &ThreadedInterner,
name: &str,
content: &str,
) -> Self
pub fn standalone( interner: &ThreadedInterner, name: &str, content: &str, ) -> Self
Creates a Source from a single piece of content without needing
a full SourceManager.
This is particularly useful for quick parsing or one-off analyses where you do not need to manage multiple sources.
§Arguments
interner- A reference to aThreadedInternerused to intern thecontentand store string identifiers.name- A logical identifier for this source, such as"inline"or"my_script.php".content- The actual PHP (or other) code string.
Sourcepub fn line_number(&self, offset: usize) -> usize
pub fn line_number(&self, offset: usize) -> usize
Sourcepub fn get_line_start_offset(&self, line: usize) -> Option<usize>
pub fn get_line_start_offset(&self, line: usize) -> Option<usize>
Sourcepub fn get_line_end_offset(&self, line: usize) -> Option<usize>
pub fn get_line_end_offset(&self, line: usize) -> Option<usize>
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Source
impl<'de> Deserialize<'de> for Source
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Ord for Source
impl Ord for Source
Source§impl PartialOrd for Source
impl PartialOrd for Source
impl Eq for Source
impl StructuralPartialEq for Source
Auto Trait Implementations§
impl Freeze for Source
impl RefUnwindSafe for Source
impl Send for Source
impl Sync for Source
impl Unpin for Source
impl UnwindSafe for Source
Blanket Implementations§
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
Mutably borrows from an owned value. Read more