pub struct SourceBuffer { /* private fields */ }Expand description
A named source buffer: its file name, its NUL-terminated bytes, and a lazily
built line index. This is the Rust analog of an llvh::MemoryBuffer
registered in a SourceMgr, but it carries its own name.
Implementations§
Source§impl SourceBuffer
impl SourceBuffer
pub fn from_str(name: impl Into<String>, contents: &str) -> SourceBuffer
pub fn from_slice_check( name: impl Into<String>, contents: &[u8], ) -> SourceBuffer
pub fn name(&self) -> &str
Sourcepub fn with_line_index<R>(&self, f: impl FnOnce(&LineIndex, &[u8]) -> R) -> R
pub fn with_line_index<R>(&self, f: impl FnOnce(&LineIndex, &[u8]) -> R) -> R
Run f with this buffer’s line index, building and caching it on first use.
Auto Trait Implementations§
impl !Freeze for SourceBuffer
impl !RefUnwindSafe for SourceBuffer
impl !Sync for SourceBuffer
impl Send for SourceBuffer
impl Unpin for SourceBuffer
impl UnsafeUnpin for SourceBuffer
impl UnwindSafe for SourceBuffer
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