An Atomic state field: non-empty base32 (the Merkle's base32 encoding).
(value: Option<&str>)
| 314 | |
| 315 | /// An Atomic state field: non-empty base32 (the Merkle's base32 encoding). |
| 316 | fn validate_state(value: Option<&str>) -> PristineResult<()> { |
| 317 | let Some(value) = value else { |
| 318 | return Ok(()); |
| 319 | }; |
| 320 | let base32 = !value.is_empty() |
| 321 | && value |
| 322 | .bytes() |
| 323 | .all(|b| b.is_ascii_uppercase() || (b'2'..=b'7').contains(&b)); |
| 324 | if !base32 { |
| 325 | return Err(PristineError::Serialization { |
| 326 | message: format!( |
| 327 | "ref mapping state field is not non-empty uppercase base32: {value:?}" |
| 328 | ), |
| 329 | }); |
| 330 | } |
| 331 | Ok(()) |
| 332 | } |
| 333 | |
| 334 | /// A mapped ref name: well-formed Git reference name under `refs/` |
| 335 | /// (git-check-ref-format's exclusions, simplified to the durable subset). |