Radish alpha
h
Radicle Heartwood Protocol & Stack
Radicle
Git (anonymous pull)
Log in to clone via SSH
core: add documentation to `RepoId::from_canonical`
✗ CI failure Fintan Halpenny committed 2 months ago
commit aeba81f4d9cf35b5bfcb0af19f5055411e4b679c
parent 35a01898e6fbe598b57d4beaf452b58a676062c9
1 failed (1 total) View logs
1 file changed +9 -0
modified crates/radicle-core/src/repo.rs
@@ -96,6 +96,15 @@ impl RepoId {
        multibase::encode(multibase::Base::Base58Btc, AsRef::<[u8]>::as_ref(&self.0))
    }

+
    /// Decode the input string into a [`RepoId`].
+
    ///
+
    /// # Errors
+
    ///
+
    /// - The [multibase] decoding fails
+
    /// - The decoded [multibase] code does not match any expected multibase code
+
    /// - The input exceeds the expected number of bytes, post multibase decoding
+
    ///
+
    /// [multibase]: https://github.com/multiformats/multibase?tab=readme-ov-file#multibase-table
    pub fn from_canonical(input: &str) -> Result<Self, IdError> {
        const EXPECTED_LEN: usize = 20;
        let (base, bytes) = multibase::decode(input)?;