imessage_database/tables/messages/models/
attachment_meta.rs1use crabstep::deserializer::iter::Property;
6
7#[derive(Debug, PartialEq, Default, Clone)]
9pub struct AttachmentMeta {
10 pub guid: Option<String>,
12 pub transcription: Option<String>,
14 pub height: Option<f64>,
16 pub width: Option<f64>,
18 pub name: Option<String>,
20}
21
22impl AttachmentMeta {
23 pub(crate) fn set_from_key_value<'a>(&mut self, key: &str, value: &Property<'a, 'a>) {
28 match key {
29 "__kIMFileTransferGUIDAttributeName" => {
30 self.guid = value.as_string().map(String::from);
31 }
32 "IMAudioTranscription" => self.transcription = value.as_string().map(String::from),
33 "__kIMInlineMediaHeightAttributeName" => self.height = value.as_f64(),
34 "__kIMInlineMediaWidthAttributeName" => self.width = value.as_f64(),
35 "__kIMFilenameAttributeName" => self.name = value.as_string().map(String::from),
36 _ => {}
37 }
38 }
39}