pub struct PosixMmapReadableFile { /* private fields */ }Expand description
| Implements random read access in a file using | mmap(). | | Instances of this class are thread-safe, as | required by the RandomAccessFile API. Instances | are immutable and Read() only calls thread-safe | library functions.
Implementations§
Source§impl PosixMmapReadableFile
impl PosixMmapReadableFile
Sourcepub fn new(
filename: String,
mmap_base: *mut u8,
length: usize,
mmap_limiter: *mut Limiter,
) -> Self
pub fn new( filename: String, mmap_base: *mut u8, length: usize, mmap_limiter: *mut Limiter, ) -> Self
| mmap_base[0, length-1] points to the | memory-mapped contents of the file. It must | be the result of a successful call to | mmap(). This instances takes over the | ownership of the region. | | |mmap_limiter| must outlive this | instance. The caller must have already | aquired the right to use one mmap region, | which will be released when this instance is | destroyed.
Trait Implementations§
Source§impl Drop for PosixMmapReadableFile
impl Drop for PosixMmapReadableFile
Source§impl GetName for PosixMmapReadableFile
impl GetName for PosixMmapReadableFile
Source§impl RandomAccessFileRead for PosixMmapReadableFile
impl RandomAccessFileRead for PosixMmapReadableFile
Source§fn read(
&self,
offset: u64,
n: usize,
result: *mut Slice,
scratch: *mut u8,
) -> Status
fn read( &self, offset: u64, n: usize, result: *mut Slice, scratch: *mut u8, ) -> Status
| Read up to “n” bytes from the file starting
| at “offset”. “scratch[0..n-1]” may be
| written by this routine. Sets “*result” to
| the data that was read (including if fewer
| than “n” bytes were successfully read). May
| set “*result” to point at data in
| “scratch[0..n-1]”, so “scratch[0..n-1]” must
| be live when “*result” is used. If an error
| was encountered, returns a non-OK status.
|
| Safe for concurrent use by multiple threads.
impl RandomAccessFile for PosixMmapReadableFile
Auto Trait Implementations§
impl Freeze for PosixMmapReadableFile
impl !RefUnwindSafe for PosixMmapReadableFile
impl !Send for PosixMmapReadableFile
impl !Sync for PosixMmapReadableFile
impl Unpin for PosixMmapReadableFile
impl !UnwindSafe for PosixMmapReadableFile
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