pub struct MappedFile {
pub file: File,
pub map: Mmap,
pub line_ending_positions: Vec<CharPosition>,
}
Expand description
A Memory Mapped File
Fields§
§file: File
The file that the memory map is mapped to
map: Mmap
The memory map of the file
line_ending_positions: Vec<CharPosition>
The cache of line ending positions
Implementations§
Source§impl MappedFile
impl MappedFile
Sourcepub fn new(file: File) -> Result<MappedFile, String>
pub fn new(file: File) -> Result<MappedFile, String>
Creates a new MappedFile from a File possibly returning an error
Sourcepub fn unicode_at(&mut self, index: usize) -> Result<char, IndexError>
pub fn unicode_at(&mut self, index: usize) -> Result<char, IndexError>
Returns the index of the line ending at the given byte position. Returns an error if the byte position is out of bounds.
Auto Trait Implementations§
impl Freeze for MappedFile
impl RefUnwindSafe for MappedFile
impl Send for MappedFile
impl Sync for MappedFile
impl Unpin for MappedFile
impl UnwindSafe for MappedFile
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