Add credit for owo faces in README.md

This commit is contained in:
EvilDeaaaadd 2019-08-01 15:50:39 +03:00
parent af362ab47d
commit 678e114af8
3 changed files with 38 additions and 2 deletions

2
.gitignore vendored
View File

@ -1,4 +1,4 @@
/target
/tests
**/*.rs.bk
Cargo.lock
/tests

View File

@ -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)

View File

@ -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"),