binaryninja::type_printer

Trait TypePrinter

source
pub trait TypePrinter {
    // Required methods
    fn get_type_tokens<T: Into<QualifiedName>>(
        &self,
        type_: Ref<Type>,
        platform: Option<Ref<Platform>>,
        name: T,
        base_confidence: u8,
        escaping: TokenEscapingType,
    ) -> Option<Vec<InstructionTextToken>>;
    fn get_type_tokens_before_name(
        &self,
        type_: Ref<Type>,
        platform: Option<Ref<Platform>>,
        base_confidence: u8,
        parent_type: Option<Ref<Type>>,
        escaping: TokenEscapingType,
    ) -> Option<Vec<InstructionTextToken>>;
    fn get_type_tokens_after_name(
        &self,
        type_: Ref<Type>,
        platform: Option<Ref<Platform>>,
        base_confidence: u8,
        parent_type: Option<Ref<Type>>,
        escaping: TokenEscapingType,
    ) -> Option<Vec<InstructionTextToken>>;
    fn get_type_string<T: Into<QualifiedName>>(
        &self,
        type_: Ref<Type>,
        platform: Option<Ref<Platform>>,
        name: T,
        escaping: TokenEscapingType,
    ) -> Option<String>;
    fn get_type_string_before_name(
        &self,
        type_: Ref<Type>,
        platform: Option<Ref<Platform>>,
        escaping: TokenEscapingType,
    ) -> Option<String>;
    fn get_type_string_after_name(
        &self,
        type_: Ref<Type>,
        platform: Option<Ref<Platform>>,
        escaping: TokenEscapingType,
    ) -> Option<String>;
    fn get_type_lines<T: Into<QualifiedName>>(
        &self,
        type_: Ref<Type>,
        types: &TypeContainer,
        name: T,
        padding_cols: isize,
        collapsed: bool,
        escaping: TokenEscapingType,
    ) -> Option<Vec<TypeDefinitionLine>>;
    fn print_all_types(
        &self,
        names: Vec<QualifiedName>,
        types: Vec<Ref<Type>>,
        data: Ref<BinaryView>,
        padding_cols: isize,
        escaping: TokenEscapingType,
    ) -> Option<String>;
}

Required Methods§

source

fn get_type_tokens<T: Into<QualifiedName>>( &self, type_: Ref<Type>, platform: Option<Ref<Platform>>, name: T, base_confidence: u8, escaping: TokenEscapingType, ) -> Option<Vec<InstructionTextToken>>

Generate a single-line text representation of a type, Returns a List of text tokens representing the type.

  • type_ - Type to print
  • platform - Platform responsible for this type
  • name - Name of the type
  • base_confidence - Confidence to use for tokens created for this type
  • escaping - Style of escaping literals which may not be parsable
source

fn get_type_tokens_before_name( &self, type_: Ref<Type>, platform: Option<Ref<Platform>>, base_confidence: u8, parent_type: Option<Ref<Type>>, escaping: TokenEscapingType, ) -> Option<Vec<InstructionTextToken>>

In a single-line text representation of a type, generate the tokens that should be printed before the type’s name. Returns a list of text tokens representing the type

  • type_ - Type to print
  • platform - Platform responsible for this type
  • base_confidence - Confidence to use for tokens created for this type
  • parent_type - Type of the parent of this type, or None
  • escaping - Style of escaping literals which may not be parsable
source

fn get_type_tokens_after_name( &self, type_: Ref<Type>, platform: Option<Ref<Platform>>, base_confidence: u8, parent_type: Option<Ref<Type>>, escaping: TokenEscapingType, ) -> Option<Vec<InstructionTextToken>>

In a single-line text representation of a type, generate the tokens that should be printed after the type’s name. Returns a list of text tokens representing the type

  • type_ - Type to print
  • platform - Platform responsible for this type
  • base_confidence - Confidence to use for tokens created for this type
  • parent_type - Type of the parent of this type, or None
  • escaping - Style of escaping literals which may not be parsable
source

fn get_type_string<T: Into<QualifiedName>>( &self, type_: Ref<Type>, platform: Option<Ref<Platform>>, name: T, escaping: TokenEscapingType, ) -> Option<String>

Generate a single-line text representation of a type. Returns a string representing the type

  • type_ - Type to print
  • platform - Platform responsible for this type
  • name - Name of the type
  • escaping - Style of escaping literals which may not be parsable
source

fn get_type_string_before_name( &self, type_: Ref<Type>, platform: Option<Ref<Platform>>, escaping: TokenEscapingType, ) -> Option<String>

In a single-line text representation of a type, generate the string that should be printed before the type’s name. Returns a string representing the type

  • type_ - Type to print
  • platform - Platform responsible for this type
  • escaping - Style of escaping literals which may not be parsable
source

fn get_type_string_after_name( &self, type_: Ref<Type>, platform: Option<Ref<Platform>>, escaping: TokenEscapingType, ) -> Option<String>

In a single-line text representation of a type, generate the string that should be printed after the type’s name. Returns a string representing the type

  • type_ - Type to print
  • platform - Platform responsible for this type
  • escaping - Style of escaping literals which may not be parsable
source

fn get_type_lines<T: Into<QualifiedName>>( &self, type_: Ref<Type>, types: &TypeContainer, name: T, padding_cols: isize, collapsed: bool, escaping: TokenEscapingType, ) -> Option<Vec<TypeDefinitionLine>>

Generate a multi-line representation of a type. Returns a list of type definition lines

  • type_ - Type to print
  • types - Type Container containing the type and dependencies
  • name - Name of the type
  • padding_cols - Maximum number of bytes represented by each padding line
  • collapsed - Whether to collapse structure/enum blocks
  • escaping - Style of escaping literals which may not be parsable
source

fn print_all_types( &self, names: Vec<QualifiedName>, types: Vec<Ref<Type>>, data: Ref<BinaryView>, padding_cols: isize, escaping: TokenEscapingType, ) -> Option<String>

Print all types to a single big string, including headers, sections, etc.

  • types - All types to print
  • data - Binary View in which all the types are defined
  • padding_cols - Maximum number of bytes represented by each padding line
  • escaping - Style of escaping literals which may not be parsable

Object Safety§

This trait is not object safe.

Implementors§