From 8afcc1511e63001229217b4ec3cd349cf7789e36 Mon Sep 17 00:00:00 2001 From: Kitaiti Makoto Date: Mon, 9 Jan 2023 06:55:49 +0900 Subject: [PATCH] Define make_fqn() --- plume-common/src/utils.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/plume-common/src/utils.rs b/plume-common/src/utils.rs index 37045d5a..4b76864b 100644 --- a/plume-common/src/utils.rs +++ b/plume-common/src/utils.rs @@ -1,4 +1,5 @@ use activitystreams::iri_string::percent_encode::PercentEncodedForIri; +use heck::ToUpperCamelCase; use openssl::rand::rand_bytes; use pulldown_cmark::{html, CodeBlockKind, CowStr, Event, LinkType, Options, Parser, Tag}; use regex_syntax::is_word_character; @@ -24,6 +25,13 @@ pub fn iri_percent_encode_seg(segment: &str) -> String { PercentEncodedForIri::from_path_segment(segment).to_string() } +pub fn make_fqn(name: &str) -> String { + name.to_upper_camel_case() + .chars() + .filter(|c| c.is_alphanumeric()) + .collect() +} + #[derive(Debug)] enum State { Mention,