refactor(backend): implement From<UpMultihash> for Address
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed

This commit is contained in:
Tomáš Mládek 2024-07-02 22:00:57 +02:00
parent 127af810d2
commit 2380f0d279
3 changed files with 8 additions and 2 deletions

View file

@ -221,6 +221,12 @@ impl FromStr for Address {
}
}
impl From<UpMultihash> for Address {
fn from(hash: UpMultihash) -> Self {
Address::Hash(hash)
}
}
impl fmt::Display for Address {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{}", b58_encode(self.encode().map_err(|_| fmt::Error)?))

View file

@ -66,7 +66,7 @@ impl Extractor for MonolithExtractor {
timestamp: chrono::Utc::now().naive_utc(),
},
],
stored: vec![Address::Hash(stored)],
stored: vec![stored.into()],
})
} else {
Ok(Default::default())

View file

@ -201,7 +201,7 @@ impl Extractor for YtDlpExtractor {
Ok(ExtractorGetResult {
entries,
stored: vec![Address::Hash(stored)],
stored: vec![stored.into()],
})
} else {
Ok(Default::default())