media: add MediaFileKey wrapper

One more win in the fight against the Vec<u8>s
This commit is contained in:
Lambda 2024-08-11 17:11:48 +00:00
parent 84850a163d
commit 1ccb1e572b
5 changed files with 38 additions and 13 deletions

View file

@ -24,6 +24,19 @@ pub(crate) struct FileMeta {
pub(crate) content_type: Option<String>,
}
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub(crate) struct MediaFileKey(Vec<u8>);
impl MediaFileKey {
pub(crate) fn new(key: Vec<u8>) -> Self {
Self(key)
}
pub(crate) fn as_bytes(&self) -> &[u8] {
&self.0
}
}
pub(crate) struct Service {
pub(crate) db: &'static dyn Data,
}