ruma_identifiers_validation/
event_id.rs

1
2
3
4
5
6
7
8
9
10
11
use crate::{validate_delimited_id, Error};

pub fn validate(s: &str) -> Result<(), Error> {
    if s.contains(':') {
        validate_delimited_id(s, b'$')?;
    } else if !s.starts_with('$') {
        return Err(Error::MissingLeadingSigil);
    }

    Ok(())
}