From aeba81f4d9cf35b5bfcb0af19f5055411e4b679c Mon Sep 17 00:00:00 2001 From: Fintan Halpenny Date: Tue, 10 Feb 2026 09:22:07 +0000 Subject: [PATCH] core: add documentation to `RepoId::from_canonical` --- crates/radicle-core/src/repo.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/crates/radicle-core/src/repo.rs b/crates/radicle-core/src/repo.rs index d567b65c..0648177f 100644 --- a/crates/radicle-core/src/repo.rs +++ b/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 { const EXPECTED_LEN: usize = 20; let (base, bytes) = multibase::decode(input)?;