memea::lef

Function parse_size

Source
fn parse_size(line: &str) -> Result<(Float, Float), LefError>
Expand description

Parses width and height from a LEF SIZE line using regex.

This function extracts two floating-point numbers from a SIZE line in a LEF file, representing the width and height of a cell in micrometers.

§Arguments

  • line - The SIZE line from the LEF file to parse

§Returns

  • Ok((width, height)) - Successfully parsed dimensions in micrometers
  • Err(LefError::InvalidSize) - Line format is invalid or missing numbers

§Examples

use memea::lef::parse_size;

let line = "    SIZE 1.5 BY 2.0 ;";
let (w, h) = parse_size(line).expect("Failed to parse size");
assert_eq!((w, h), (1.5, 2.0));