memea

Function parse_tuple

Source
pub fn parse_tuple(line: &str) -> Result<(Float, Float), MemeaError>
Expand description

Parses a tuple of two floating-point values from a string.

This function extracts two numeric values from a string, handling various separators including commas, semicolons, and whitespace.

§Arguments

  • line - String containing two numeric values with separators

§Returns

  • Ok((a, b)) - Successfully parsed tuple of values
  • Err(MemeaError) - Parsing error if format is invalid or values cannot be parsed

§Examples

use memea::parse_tuple;

let (a, b) = parse_tuple("1.5; 2.7").expect("Failed to parse tuple");
assert_eq!((a, b), (1.5, 2.7));