Skip to main content

Module names

Module names 

Source
Expand description

Validated string identifier types and the StringLike trait.

Three newtype wrappers enforce invariants on string values used as identifiers:

TypeMax lengthAllowed content
Name32Starts with ASCII letter; then [a-zA-Z0-9_-]; normalised to lowercase on parse
DisplayName48Any string under the limit (human-readable labels)
Tag24Non-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");

Structs§

DisplayName
Name
Tag

Constants§

RFHAM_URN_PREFIX

Traits§

StringLike

Functions§

brand_name_baofeng
brand_name_chameleon
brand_name_elecraft
brand_name_gabil
brand_name_icom
brand_name_kenwood
brand_name_yaesu