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 e3ba0b6fe5ba7662637a0d1da427c6fa1260d12f
parent 7abd7bba9e2885a91e68abba7b28d0b64b68b5b0
1 failed (1 total) View logs
1 file changed +9 -0
modified crates/radicle-core/src/repo.rs
@@ -97,6 +97,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)?;