Skip to main content

validate_topic

Function validate_topic 

Source
pub fn validate_topic(topic: &str) -> Result<(), Error>
Expand description

Validate a frame topic (per ADR 0001).

A topic must be non-empty and at most 255 bytes, start with an ASCII letter or _, and contain only a-z A-Z 0-9 _ - .. It may not end with . or contain consecutive dots. Store::append runs this automatically; call it directly to validate user input before building a Frame.

use xs::store::validate_topic;

assert!(validate_topic("clip.add").is_ok());
assert!(validate_topic("clip.").is_err());