Trait pdb::Source [] [src]

pub trait Source<'s>: Debug {
    fn view(&mut self,
            slices: &[SourceSlice])
            -> Result<Box<SourceView<'s>>, Error>; }

Source provides raw access to a PDB.

This library is written with zero-copy in mind. Sources provide SourceViews which need not outlive their parent, supporting implementations of e.g. memory mapped files.

PDB files are "multi-stream files" (MSF) under the hood. MSFs have various layers of indirection, but ultimately the MSF code asks a Source to view a series of { offset, size } records (each a SourceSlice) as a contiguous &[u8] (provided by SourceView).

The requested offsets will always be aligned to the MSF's page size, which is always a power of two and is usually (but not always) 4 KiB. The requested sizes will also be multiples of the page size, except for the size of the final SourceSlice, which may be smaller. PDB files are specified as always being a multiple of the page size, so Source implementations are free to e.g. map whole pages and return a sub-slice of the requested length.

Required Methods

Provides a contiguous view of the source file composed of the requested position(s).

Note that the SourceView's as_slice() method cannot fail, so view() is the time to raise IO errors.

Implementors