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>
impl<'a> SrcSrvStream<'a>
Sourcepub fn parse(stream: &'a [u8]) -> Result<SrcSrvStream<'a>, ParseError>
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())?;
}Sourcepub fn index_version(&self) -> Option<&'a str>
pub fn index_version(&self) -> Option<&'a str>
The value of the INDEXVERSION field from the ini section, if specified.
Sourcepub fn datetime(&self) -> Option<&'a str>
pub fn datetime(&self) -> Option<&'a str>
The value of the DATETIME field from the ini section, if specified.
Sourcepub fn version_control_description(&self) -> Option<&'a str>
pub fn version_control_description(&self) -> Option<&'a str>
The value of the VERCTRL field from the ini section, if specified.
Sourcepub fn source_for_path(
&self,
original_file_path: &str,
extraction_base_path: &str,
) -> Result<Option<SourceRetrievalMethod>, EvalError>
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"#
)?
);Sourcepub fn source_and_raw_var_values_for_path(
&self,
original_file_path: &str,
extraction_base_path: &str,
) -> Result<Option<(SourceRetrievalMethod, EvalVarMap)>, EvalError>
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.
Sourcepub fn error_persistence_command_output_strings(&self) -> HashSet<&'a str>
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.
Sourcepub fn get_ini_field(&self, field_name: &str) -> Option<&'a str>
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.
Sourcepub fn get_raw_var(&self, var_name: &str) -> Option<&'a str>
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.