We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 758e9bd commit fa61b8bCopy full SHA for fa61b8b
crates/value/src/id_v6.rs
@@ -83,6 +83,14 @@ impl DocumentIdV6 {
83
base32::encode(&buf[..pos])
84
}
85
86
+ /// Is the given string an ID that's not in its canonical encoding?
87
+ pub fn is_noncanonical_id(s: &str) -> bool {
88
+ let Ok(id) = Self::decode(s) else {
89
+ return false;
90
+ };
91
+ s != id.encode()
92
+ }
93
+
94
pub fn decode(s: &str) -> Result<Self, IdDecodeError> {
95
// NB: We want error paths to be as quick as possible, even if `s` is very long.
96
// So, be sure to do the length check before decoding the base32.
0 commit comments