Crates.io | owoify_rs |
lib.rs | owoify_rs |
version | 1.1.0 |
source | src |
created_at | 2020-06-21 07:03:38.361922 |
updated_at | 2023-12-03 17:24:54.302629 |
description | This Rust port of mohan-cao's owoify-js is released under MIT license, which is also the same license of owoify-js. This simple library will turn any string into nonsensical babyspeak similar to what LeafySweet's infamous Chrome extension did. |
homepage | https://github.com/deadshot465/owoify_rs |
repository | https://github.com/deadshot465/owoify_rs |
max_upload_size | |
id | 256235 |
size | 224,240 |
Turning your worst nightmare into a crate package.
This is a Rust port of mohan-cao's owoify-js, which will help you turn any string into nonsensical babyspeak similar to LeafySweet's infamous Chrome extension.
Just like owoify-js, three levels are available for owoifying your texts:
Please refer to the original owoify-js repository for more information.
While there is already an owoify crate on crates.io, it doesn't provide different levels of owoness, and the owoness is also lighter, which makes the resulting sentences far more readable. For any user who wants to use owoify, the less readable the sentence, the better in my humble opinion.
Just like any crates, simply put this line inside your Cargo.toml
:
[dependencies]
owoify_rs = "~1.0.0"
Alternatively, pull the crate directly from the repository:
[dependencies]
owoify_rs = { git = "https://github.com/deadshot465/owoify_rs", branch = "regex" }
Note that the reason for setting the branch and that the default branch is the regex
branch is that the onig crate seems to have some inconsistencies despite the regexes are the same.
Owoify-rs is implemented as a trait, and is implemented for both String
and &str
.
use owoify_rs::{Owoifiable, OwoifyLevel};
fn main() {
let owo_str = String::from("This is the string to owo! Kinda cute isn't it?");
let uvu_str = String::from("This is the string to owo! Kinda cute isn't it?");
println!("{}", owo_str.owoify(OwoifyLevel::Owo));
println!("{}", uvu_str.owoify(OwoifyLevel::Uvu));
// Output:
// This is teh stwing two owo! Kinda cute isn't it?
// fwis is teh stwing twowo owowowo (⌒ω⌒) Kinda cute isn't it?
}
Since the regex crate doesn't support negative lookahead, and onig
shows inconsistent behaviors despite the regexes being the same as when using regex
, and fancy-regex doesn't support captures_iter()
method at moment, currently the negative lookahead parts of these three regexes are omitted.
See the source code of src/utility/mappings.rs
to see commented out regexes.
This crate was written to help myself get used to Rust's syntaxes and writing Rust programs. Performance is NOT guaranteed.