[][src]Trait ferrisetw::parser::TryParse

pub trait TryParse<T> {
    fn try_parse(&mut self, name: &str) -> Result<T, ParserError>;
}
[]

Trait to try and parse a type

This trait has to be implemented in order to be able to parse a type we want to retrieve from within an Event. On success the parsed value will be returned within a Result, on error an Err should be returned accordingly

An implementation for most of the Primitive Types is created by using a Macro, any other needed type requires this trait to be implemented

Required methods

fn try_parse(&mut self, name: &str) -> Result<T, ParserError>[]

Implement the try_parse function to provide a way to Parse T from an ETW event or return an Error in case the type T can't be parsed

Arguments

  • name - Name of the property to be found in the Schema

Implementors

impl<'_> TryParse<IpAddr> for Parser<'_>[src][+]

impl<'_> TryParse<i8> for Parser<'_>[src][+]

impl<'_> TryParse<i16> for Parser<'_>[src][+]

impl<'_> TryParse<i32> for Parser<'_>[src][+]

impl<'_> TryParse<i64> for Parser<'_>[src][+]

impl<'_> TryParse<isize> for Parser<'_>[src][+]

impl<'_> TryParse<u8> for Parser<'_>[src][+]

impl<'_> TryParse<u16> for Parser<'_>[src][+]

impl<'_> TryParse<u32> for Parser<'_>[src][+]

impl<'_> TryParse<u64> for Parser<'_>[src][+]

impl<'_> TryParse<usize> for Parser<'_>[src][+]

impl<'_> TryParse<Pointer> for Parser<'_>[src][+]

impl<'_> TryParse<String> for Parser<'_>[src][+]

The String impl of the TryParse trait should be used to retrieve the following TdhInTypes:

  • InTypeUnicodeString
  • InTypeAnsiString
  • InTypeCountedString
  • InTypeGuid

On success a String with the with the data from the name property will be returned

Arguments

  • name - Name of the property to be found in the Schema

Example

let my_callback = |record: EventRecord, schema_locator: &mut SchemaLocator| {
    let schema = schema_locator.event_schema(record)?;
    let parser = Parse::create(&schema);
    let image_name: String = parser.try_parse("ImageName")?;
};

impl<'_> TryParse<Vec<u8>> for Parser<'_>[src][+]

impl<'_> TryParse<Guid> for Parser<'_>[src][+]