Sha256: 9564fcf47000e70d521b31518e205c8e6ee09b7410fb1eb1e452721757ff54ba

Contents?: true

Size: 466 Bytes

Versions: 29

Compression:

Stored size: 466 Bytes

Contents

use super::{mystd::io::Read, File};
use alloc::vec::Vec;
use core::ops::Deref;

pub struct Mmap {
    vec: Vec<u8>,
}

impl Mmap {
    pub unsafe fn map(mut file: &File, len: usize) -> Option<Mmap> {
        let mut mmap = Mmap {
            vec: Vec::with_capacity(len),
        };
        file.read_to_end(&mut mmap.vec).ok()?;
        Some(mmap)
    }
}

impl Deref for Mmap {
    type Target = [u8];

    fn deref(&self) -> &[u8] {
        &self.vec[..]
    }
}

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
wasmtime-28.0.0 ./ext/cargo-vendor/backtrace-0.3.74/src/symbolize/gimli/mmap_fake.rs
wasmtime-27.0.0 ./ext/cargo-vendor/backtrace-0.3.74/src/symbolize/gimli/mmap_fake.rs
wasmtime-26.0.0 ./ext/cargo-vendor/backtrace-0.3.74/src/symbolize/gimli/mmap_fake.rs
wasmtime-25.0.2 ./ext/cargo-vendor/backtrace-0.3.73/src/symbolize/gimli/mmap_fake.rs
wasmtime-25.0.1 ./ext/cargo-vendor/backtrace-0.3.73/src/symbolize/gimli/mmap_fake.rs
wasmtime-25.0.0 ./ext/cargo-vendor/backtrace-0.3.73/src/symbolize/gimli/mmap_fake.rs
wasmtime-24.0.0 ./ext/cargo-vendor/backtrace-0.3.73/src/symbolize/gimli/mmap_fake.rs
wasmtime-23.0.2 ./ext/cargo-vendor/backtrace-0.3.69/src/symbolize/gimli/mmap_fake.rs
wasmtime-22.0.0 ./ext/cargo-vendor/backtrace-0.3.69/src/symbolize/gimli/mmap_fake.rs
wasmtime-21.0.1 ./ext/cargo-vendor/backtrace-0.3.69/src/symbolize/gimli/mmap_fake.rs
wasmtime-20.0.2 ./ext/cargo-vendor/backtrace-0.3.69/src/symbolize/gimli/mmap_fake.rs
wasmtime-20.0.0 ./ext/cargo-vendor/backtrace-0.3.69/src/symbolize/gimli/mmap_fake.rs
wasmtime-18.0.3 ./ext/cargo-vendor/backtrace-0.3.69/src/symbolize/gimli/mmap_fake.rs
wasmtime-17.0.1 ./ext/cargo-vendor/backtrace-0.3.69/src/symbolize/gimli/mmap_fake.rs
wasmtime-17.0.0 ./ext/cargo-vendor/backtrace-0.3.69/src/symbolize/gimli/mmap_fake.rs
wasmtime-16.0.0 ./ext/cargo-vendor/backtrace-0.3.69/src/symbolize/gimli/mmap_fake.rs
wasmtime-15.0.1 ./ext/cargo-vendor/backtrace-0.3.69/src/symbolize/gimli/mmap_fake.rs
wasmtime-15.0.0 ./ext/cargo-vendor/backtrace-0.3.69/src/symbolize/gimli/mmap_fake.rs
wasmtime-14.0.4 ./ext/cargo-vendor/backtrace-0.3.69/src/symbolize/gimli/mmap_fake.rs
wasmtime-14.0.3 ./ext/cargo-vendor/backtrace-0.3.69/src/symbolize/gimli/mmap_fake.rs