Skip to main content

parse_interface_file

Function parse_interface_file 

Source
pub fn parse_interface_file(
    pkg_name: &str,
    file_path: &Path,
) -> ParseResult<InterfaceSpecification>
Expand description

Parse any ROS2 interface file based on its extension

Automatically detects the file type based on the extension:

  • .msg files are parsed as messages
  • .srv files are parsed as services
  • .action files are parsed as actions

§Arguments

  • pkg_name - The package name containing the interface
  • file_path - Path to the interface file

§Returns

Returns an InterfaceSpecification enum containing the parsed specification

§Errors

Returns an error if:

  • The file extension is not recognized (must be .msg, .srv, or .action)
  • The file cannot be read
  • The content cannot be parsed for the detected file type