From: Ian Jackson Date: Mon, 3 May 2021 23:55:02 +0000 (+0100) Subject: AssetUrlKey: wip, more X-Git-Tag: otter-0.6.0~404 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=6e2d307dae00c129e2d83cac882a0a828dcd648c;p=otter.git AssetUrlKey: wip, more Signed-off-by: Ian Jackson --- diff --git a/src/bundles.rs b/src/bundles.rs index bd84f294..96b49190 100644 --- a/src/bundles.rs +++ b/src/bundles.rs @@ -73,7 +73,12 @@ impl AssetUrlKey { AssetUrlKey::Y(buf) } } -pub type AssetUrlToken = digest::Output; +#[derive(Clone)] +pub struct AssetUrlToken(digest::Output); +impl Debug for AssetUrlToken { + #[throws(fmt::Error)] + fn fmt(&self, f: &mut Formatter) { write!(f, "AssetUrlToken{{..}}")?; } +} impl AssetUrlKey { pub fn token(&self, what: &str, v: V) -> AssetUrlToken where V: Serialize { @@ -85,7 +90,7 @@ impl AssetUrlKey { write!(dw, "{}\0", what).unwrap(); dw.write(&k[..]).unwrap(); rmp_serde::encode::write(&mut dw, &v).expect("serialize failed!"); - dw.finish().0 + AssetUrlToken(dw.finish().0) } }