pub struct ContextPdbData<'p, 's, S: Source<'s> + Send + 's> { /* private fields */ }
Expand description

Allows to easily create a Context directly from a pdb::PDB.

let pdb = pdb::PDB::open(stream)?;
let context_data = pdb_addr2line::ContextPdbData::try_from_pdb(pdb)?;
let context = context_data.make_context()?;

Implementation note: It would be nice if a Context could be created from a PDB directly, without going through an intermediate ContextPdbData object. However, there doesn’t seem to be an easy way to do this, due to certain lifetime dependencies: The Context object wants to store certain objects inside itself (mostly for caching) which have a lifetime dependency on pdb::ModuleInfo, so the ModuleInfo has to be owned outside of the Context. So the ContextPdbData object acts as that external ModuleInfo owner.

Implementations§

source§

impl<'p, 's, S: Source<'s> + Send + 's> ContextPdbData<'p, 's, S>

source

pub fn try_from_pdb(pdb: PDB<'s, S>) -> Result<Self, Error>

Create a ContextPdbData from a PDB. This parses many of the PDB streams and stores them in the ContextPdbData. This creator function takes ownership of the pdb object and never gives it back.

source

pub fn try_from_pdb_ref(pdb: &'p mut PDB<'s, S>) -> Result<Self, Error>

Create a ContextPdbData from a PDB. This parses many of the PDB streams and stores them in the ContextPdbData. This creator function takes an exclusive reference to the pdb object, for consumers that want to keep using the pdb object once the ContextPdbData object is dropped.

source

pub fn make_type_formatter(&self) -> Result<TypeFormatter<'_, 's>, Error>

Create a TypeFormatter. This uses the default TypeFormatter settings.

source

pub fn make_type_formatter_with_flags( &self, flags: TypeFormatterFlags ) -> Result<TypeFormatter<'_, 's>, Error>

Create a TypeFormatter, using the specified TypeFormatter flags.

source

pub fn make_context(&self) -> Result<Context<'_, 's>, Error>

Create a Context. This uses the default TypeFormatter settings.

source

pub fn make_context_with_formatter_flags( &self, flags: TypeFormatterFlags ) -> Result<Context<'_, 's>, Error>

Create a Context, using the specified TypeFormatterFlags.

Trait Implementations§

source§

impl<'p, 's, S: Source<'s> + Send + 's> ModuleProvider<'s> for ContextPdbData<'p, 's, S>

source§

fn get_module_info( &self, module_index: usize, module: &Module<'_> ) -> Result<Option<&ModuleInfo<'s>>, Error>

Get the module info for this module from the PDB.

Auto Trait Implementations§

§

impl<'p, 's, S> !RefUnwindSafe for ContextPdbData<'p, 's, S>

§

impl<'p, 's, S> Send for ContextPdbData<'p, 's, S>

§

impl<'p, 's, S> Sync for ContextPdbData<'p, 's, S>

§

impl<'p, 's, S> Unpin for ContextPdbData<'p, 's, S>

§

impl<'p, 's, S> !UnwindSafe for ContextPdbData<'p, 's, S>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.