Skip to main content

variable

Function variable 

Source
pub fn variable(s: &str) -> Option<&str>
Expand description

The variable that a string of a specification is exactly, name for $name or ${name} (letters, digits, _ and ., not starting with a digit), None for any other string.

ยงExamples

use comnum_spec::variable;
assert_eq!(variable("$ebn0_db"), Some("ebn0_db"));
assert_eq!(variable("${fiber.span_km}"), Some("fiber.span_km"));
assert_eq!(variable("${a}_${b}"), None);