summaryrefslogtreecommitdiff
path: root/dichroism/src/image_api.rs
diff options
context:
space:
mode:
authorAdam T. Carpenter <atc@53hor.net>2020-10-05 22:05:58 -0400
committerAdam T. Carpenter <atc@53hor.net>2020-10-05 22:05:58 -0400
commit743ae22168b1fcdf2e1e54bcadbb1bb3fce3370d (patch)
tree3d393ff1ffd06d1bf470430b2316f46000794806 /dichroism/src/image_api.rs
parentf8bf353073220ce329d8eb347e3574d5793b6d26 (diff)
downloadtheglassyladies-743ae22168b1fcdf2e1e54bcadbb1bb3fce3370d.tar.xz
theglassyladies-743ae22168b1fcdf2e1e54bcadbb1bb3fce3370d.zip
started work on schema, models, and repos
Diffstat (limited to 'dichroism/src/image_api.rs')
-rw-r--r--dichroism/src/image_api.rs11
1 files changed, 6 insertions, 5 deletions
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<data>.+)").expect("Couldn't parse Regex!");
-}
+use once_cell::sync::Lazy;
+
+static DATA_URI_RE: Lazy<Regex> = Lazy::new(|| {
+ Regex::new("^data:image/(png|jpeg);base64,(?P<data>.+)").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())
}