From 678e114af8773d5f84cc308b0a78dbc038764cbb Mon Sep 17 00:00:00 2001 From: EvilDeaaaadd Date: Thu, 1 Aug 2019 15:50:39 +0300 Subject: [PATCH] Add credit for owo faces in README.md --- .gitignore | 2 +- README.md | 28 ++++++++++++++++++++++++++++ src/lib.rs | 10 +++++++++- 3 files changed, 38 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index daaca46..a3701a9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ /target +/tests **/*.rs.bk Cargo.lock -/tests diff --git a/README.md b/README.md index e69de29..25fa1e5 100644 --- a/README.md +++ b/README.md @@ -0,0 +1,28 @@ +# owoify +A simple rust library for string owoification. +Inspired by: +* [owo text generator](https://honk.moe/tools/owo.html) +* [OWO Chrome extension](https://chrome.google.com/webstore/detail/owo/jolaggjkdhhgcdhcjjhfkkbllefoggob?hl=en) + +# Credits +* [MashAllPotatoes](https://twitter.com/MashNewGamePlus) - Regular expressions and some of the owo faces + +# Usage +Add this to ``Cargo.toml``: + +``` +[dependencies] +owoify = "0.1.0" +``` +``example.rs``: +``` +use owoify::OwOifiable; + +fn main() { + let text = String::from("euthanize me senpai!!"); + println!("{}", text.owoify()); +} +``` + +# Documentation +* [Docs.rs](https://docs.rs/owoify) diff --git a/src/lib.rs b/src/lib.rs index f87b48a..21e5a3b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -24,9 +24,17 @@ pub trait OwOifiable { } impl OwOifiable for String { + /// Owoifies a String + /// + /// # Examples + /// + /// ``` + /// use use owoify::OwOifiable; + /// let owoified = String::from("Example text").owoify(); + /// ``` fn owoify(&self) -> Self { let mut rng = rand::thread_rng(); - let faces = ["(・`ω´・)", ";;w;;", "owo", "UwU", ">w<", "^w^"]; + let faces = ["(・`ω´・)", "OwO", "owo", "oωo", "òωó", "°ω°", "UwU", ">w<", "^w^"]; let face = &format!(" {} ", faces[rng.gen_range(0, faces.len())]).to_owned(); let pats: Vec<(&str, &str)> = vec![ ("(?:r|l)", "w"),