Struct zalgo::Generator [−][src]
pub struct Generator { /* fields omitted */ }
A generator to perform zalgo operations.
This is a structure that contains an internal rand::ThreadRng
instance.
Methods
impl Generator
[src]
impl Generator
pub fn new() -> Self
[src]
pub fn new() -> Self
Creates a new generator with a new ThreadRng instance.
pub fn gen<T: AsRef<str>>(
&mut self,
text: T,
buf: &mut String,
args: &GeneratorArgs
)
[src]
pub fn gen<T: AsRef<str>>(
&mut self,
text: T,
buf: &mut String,
args: &GeneratorArgs
)
Generates a String containing Zalgo text. This is customizable via defining whether to include Zalgo text above the given string, in the middle of it, and below it.
The amount of Zalgo text can be (more or less) defined by the value of
the size
given. Read on the ZalgoSize
for more information.
Examples
Create Zalgo text with Zalgo char
s in all positions, with a maximum
amount of Zalgo:
use zalgo::{Generator, GeneratorArgs, ZalgoSize}; let mut generator = Generator::new(); let args = GeneratorArgs::new(true, true, true, ZalgoSize::Maxi); let mut out = String::new(); generator.gen("test", &mut out, &args);
Create Zalgo text with Zalgo char
s in only the middle and lower
positions, with a minimum amount of Zalgo:
use zalgo::{Generator, GeneratorArgs, ZalgoSize}; let mut generator = Generator::new(); let args = GeneratorArgs::new(false, true, true, ZalgoSize::Mini); let mut out = String::new(); generator.gen("test", &mut out, &args);
Create Zalgo text with Zalgo char
s in only the lower position, with a
random amount of Zalgo (can be a low amount or high amount):
use zalgo::{Generator, GeneratorArgs, ZalgoSize}; let mut generator = Generator::new(); let args = GeneratorArgs::new(false, false, true, ZalgoSize::None); let mut out = String::new(); generator.gen("test", &mut out, &args);
Consequentially, you can also not modify your given text with any Zalgo:
use zalgo::{Generator, GeneratorArgs, ZalgoSize}; let mut generator = Generator::new(); let args = GeneratorArgs::new(false, false, false, ZalgoSize::None); let mut out = String::new(); generator.gen("test", &mut out, &args); // Technically the `ZalgoSize` value given does not matter here.
pub fn gen_simple<T: AsRef<str>>(&mut self, text: T, buf: &mut String)
[src]
pub fn gen_simple<T: AsRef<str>>(&mut self, text: T, buf: &mut String)
A simple function to generate a String containing Zalgo text.
Unlike gen
, this is not customizable. This produces zalgo above, in
the middle, and below the string.
Examples
Create Zalgo text:
use zalgo::Generator; let mut out = String::new(); let mut generator = Generator::new(); generator.gen_simple("test", &mut out);