diff options
-rw-r--r-- | core/src/resource/mod.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/core/src/resource/mod.rs b/core/src/resource/mod.rs index 0070f24..8b7e9e1 100644 --- a/core/src/resource/mod.rs +++ b/core/src/resource/mod.rs @@ -114,6 +114,7 @@ Source->| | | - Use QuotedPrintable - NotHint */ +use headers::header_components::ContentId; mod source; mod data; @@ -180,4 +181,13 @@ impl Resource { pub fn plain_text(content: impl Into<String>, ctx: &impl Context) -> Resource { Resource::Data(Data::plain_text(content, ctx.generate_content_id())) } + + /// Return the content id, if there is any. + pub fn content_id(&self) -> Option<&ContentId> { + match self { + &Resource::Source(..) => None, + &Resource::Data(ref data) => Some(data.content_id()), + &Resource::EncData(ref enc_data) => Some(enc_data.content_id()) + } + } }
\ No newline at end of file |