Expand description
Validated string identifier types and the StringLike trait.
Three newtype wrappers enforce invariants on string values used as identifiers:
| Type | Max length | Allowed content |
|---|---|---|
Name | 32 | Starts with ASCII letter; then [a-zA-Z0-9_-]; normalised to lowercase on parse |
DisplayName | 48 | Any string under the limit (human-readable labels) |
Tag | 24 | Non-empty; no whitespace |
The [name_fn!] macro generates zero-cost fn accessors that return a typed Name
literal, avoiding repeated new_unchecked calls at call sites.
§Examples
use rfham_core::id::{Name, StringLike};
use std::str::FromStr;
let n: Name = Name::from_str("Yaesu").unwrap();
assert_eq!(n.as_str(), "yaesu"); // normalised to lowercase
assert!(Name::is_valid("elecraft"));
assert!(!Name::is_valid("9bad")); // must start with a letter
assert!(!Name::is_valid(""));Pre-defined brand-name accessors:
use rfham_core::id::{brand_name_icom, brand_name_yaesu, StringLike};
assert_eq!(brand_name_icom().as_str(), "icom");
assert_eq!(brand_name_yaesu().as_str(), "yaesu");