From b1ba906491a1ed396d47b0751f080fef991ea344 Mon Sep 17 00:00:00 2001 From: jelemux Date: Wed, 25 Nov 2020 10:31:04 +0100 Subject: Struktur umbauen --- src/view/input_objects/utility.rs | 39 --------------------------------------- 1 file changed, 39 deletions(-) delete mode 100644 src/view/input_objects/utility.rs (limited to 'src/view/input_objects/utility.rs') diff --git a/src/view/input_objects/utility.rs b/src/view/input_objects/utility.rs deleted file mode 100644 index a296c1e..0000000 --- a/src/view/input_objects/utility.rs +++ /dev/null @@ -1,39 +0,0 @@ -#[derive(Clone)] -pub struct Download { - pub file_name: String, - pub content: String, - pub mime_type: MimeType, -} - -impl Download { - pub fn as_data_link(&self) -> String { - let data = base64::encode(&*self.content); - let uri_component: String = js_sys::encode_uri_component(&data).into(); - - format!("data:{};base64,{}", self.mime_type.as_text(), uri_component) - } -} - -#[derive(Clone, Copy)] -pub enum MimeType { - PDF, - VCard, - SVG, -} - -impl MimeType { - pub fn as_text(&self) -> &str { - match self { - MimeType::PDF => "application/pdf", - MimeType::VCard => "text/vcard", - MimeType::SVG => "image/svg+xml", - } - } -} - -#[derive(Clone, Copy)] -pub enum DownloadOption { - PDF, - VCard, - QrCode, -} \ No newline at end of file -- cgit v1.2.3