SrcSrvStream

Struct SrcSrvStream 

Source
pub struct SrcSrvStream<'a> { /* private fields */ }
Expand description

A parsed representation of the srcsrv stream from a PDB file.

Implementations§

Source§

impl<'a> SrcSrvStream<'a>

Source

pub fn parse(stream: &'a [u8]) -> Result<SrcSrvStream<'a>, ParseError>

Parse the srcsrv stream. The stream bytes can be obtained with the help of the PDB::named_stream method from the pdb crate.

use srcsrv::SrcSrvStream;

if let Ok(srcsrv_stream) = pdb.named_stream(b"srcsrv") {
    let stream = SrcSrvStream::parse(srcsrv_stream.as_slice())?;
}
Source

pub fn version(&self) -> u8

The value of the VERSION field from the ini section.

Source

pub fn index_version(&self) -> Option<&'a str>

The value of the INDEXVERSION field from the ini section, if specified.

Source

pub fn datetime(&self) -> Option<&'a str>

The value of the DATETIME field from the ini section, if specified.

Source

pub fn version_control_description(&self) -> Option<&'a str>

The value of the VERCTRL field from the ini section, if specified.

Source

pub fn source_for_path( &self, original_file_path: &str, extraction_base_path: &str, ) -> Result<Option<SourceRetrievalMethod>, EvalError>

Look up original_file_path in the file entries and find out how to obtain the source for this file. This evaluates the variables for the matching file entry.

extraction_base_path is used as the value of the special %targ% variable and should not include a trailing backslash.

Returns Ok(None) if the file path was not found in the list of file entries.

use srcsrv::{SrcSrvStream, SourceRetrievalMethod};

println!(
    "{:#?}",
    stream.source_for_path(
        r#"C:\build\renderdoc\renderdoc\data\glsl\gl_texsample.h"#,
        r#"C:\Debugger\Cached Sources"#
    )?
);
Source

pub fn source_and_raw_var_values_for_path( &self, original_file_path: &str, extraction_base_path: &str, ) -> Result<Option<(SourceRetrievalMethod, EvalVarMap)>, EvalError>

Look up original_file_path in the file entries and find out how to obtain the source for this file. This evaluates the variables for the matching file entry.

extraction_base_path is used as the value of the special %targ% variable and should not include a trailing backslash.

This method additionally returns the raw values of all variables. This gives consumers more ways to special-case their behavior. It also acts as an escape hatch if there are any cases that SourceRetrievalMethod does not cover. If you don’t need the raw variable values, prefer to call source_for_path instead.

Returns Ok(None) if the file path was not found in the list of file entries.

Source

pub fn error_persistence_command_output_strings(&self) -> HashSet<&'a str>

A set of strings which can be substring-matched to the output of the command that is executed when obtaining source files.

If any of the strings matches, it is recommended to “persist the error” and refuse to execute further commands for other files with the same error_persistence_version_control value.

Source

pub fn get_ini_field(&self, field_name: &str) -> Option<&'a str>

Get the value of the specified field from the ini section. The field name is case-insensitive.

Source

pub fn get_raw_var(&self, var_name: &str) -> Option<&'a str>

Get the raw, unevaluated value of the specified field from the variables section. The field name is case-insensitive.

Auto Trait Implementations§

§

impl<'a> Freeze for SrcSrvStream<'a>

§

impl<'a> RefUnwindSafe for SrcSrvStream<'a>

§

impl<'a> Send for SrcSrvStream<'a>

§

impl<'a> Sync for SrcSrvStream<'a>

§

impl<'a> Unpin for SrcSrvStream<'a>

§

impl<'a> UnwindSafe for SrcSrvStream<'a>

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>,

Source§

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>,

Source§

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.