mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-02 01:52:51 +00:00
Inline a few methods
This commit is contained in:
parent
8331dbe6d0
commit
5773e51678
@ -13,6 +13,7 @@ pub struct Mmap(Vec<u8>);
|
||||
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
impl Mmap {
|
||||
#[inline]
|
||||
pub unsafe fn map(file: File) -> io::Result<Self> {
|
||||
memmap2::Mmap::map(&file).map(Mmap)
|
||||
}
|
||||
@ -20,6 +21,7 @@ impl Mmap {
|
||||
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
impl Mmap {
|
||||
#[inline]
|
||||
pub unsafe fn map(mut file: File) -> io::Result<Self> {
|
||||
use std::io::Read;
|
||||
|
||||
@ -32,6 +34,7 @@ impl Mmap {
|
||||
impl Deref for Mmap {
|
||||
type Target = [u8];
|
||||
|
||||
#[inline]
|
||||
fn deref(&self) -> &[u8] {
|
||||
&*self.0
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user