diff options
| author | Max Audron <audron@cocaine.farm> | 2021-10-16 13:02:59 +0200 |
|---|---|---|
| committer | Max Audron <audron@cocaine.farm> | 2021-10-16 13:41:52 +0200 |
| commit | 08169250954d62d9145aa9b819000edd904e75a6 (patch) | |
| tree | f809f9e16b6623789a72f1596e52ce87efe8b879 | |
| parent | Also quote_plus on API url input query string (diff) | |
make util functions world public
Diffstat (limited to '')
| -rw-r--r-- | src/util/formatting.rs | 2 | ||||
| -rw-r--r-- | src/util/web.rs | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/src/util/formatting.rs b/src/util/formatting.rs index add3f1b..c1b6257 100644 --- a/src/util/formatting.rs +++ b/src/util/formatting.rs @@ -1,7 +1,7 @@ /// Truncates a string after a certain number of characters. /// Function always tries to truncate on a word boundary. /// Reimplemented from gonzobot. -pub(crate) fn truncate(text: &str, len: usize) -> String { +pub fn truncate(text: &str, len: usize) -> String { if text.len() <= len { return text.to_string(); } diff --git a/src/util/web.rs b/src/util/web.rs index fec7bb0..b9f44c1 100644 --- a/src/util/web.rs +++ b/src/util/web.rs @@ -4,12 +4,12 @@ use reqwest::{get, Url}; use urlparse::quote_plus as urlparse_quote_plus; #[async_trait] -pub(crate) trait UrlShortener { +pub trait UrlShortener { fn new() -> Self; async fn shorten(&self, url: &str) -> Result<String, Error>; } -pub(crate) struct IsgdUrlShortener {} +pub struct IsgdUrlShortener {} #[async_trait] impl UrlShortener for IsgdUrlShortener { @@ -31,7 +31,7 @@ impl UrlShortener for IsgdUrlShortener { } } -pub(crate) fn quote_plus(text: &str) -> Result<String, Error> { +pub fn quote_plus(text: &str) -> Result<String, Error> { Ok(urlparse_quote_plus(text, b"")?) } |
