From 743ae22168b1fcdf2e1e54bcadbb1bb3fce3370d Mon Sep 17 00:00:00 2001 From: "Adam T. Carpenter" Date: Mon, 5 Oct 2020 22:05:58 -0400 Subject: started work on schema, models, and repos --- dichroism/src/image_api.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'dichroism/src/image_api.rs') diff --git a/dichroism/src/image_api.rs b/dichroism/src/image_api.rs index 44effe4..97faead 100644 --- a/dichroism/src/image_api.rs +++ b/dichroism/src/image_api.rs @@ -3,10 +3,11 @@ use crate::result::Result; use base64::decode; use regex::Regex; -lazy_static! { - static ref DATA_URI_RE: Regex = - Regex::new("^data:image/(png|jpeg);base64,(?P.+)").expect("Couldn't parse Regex!"); -} +use once_cell::sync::Lazy; + +static DATA_URI_RE: Lazy = Lazy::new(|| { + Regex::new("^data:image/(png|jpeg);base64,(?P.+)").expect("Couldn't parse Regex.") +}); pub fn generate_images(data: &str) -> Result<()> { let bytes = decode(data)?; @@ -24,7 +25,7 @@ pub fn extract_data(uri: &str) -> Result<&str> { Ok(caps .name("data") - .expect("Should never fail if regex succeeded") + .expect("Should never fail if regex succeeded.") .as_str()) } -- cgit v1.2.3