Struct GeneratorArgs

Source
pub struct GeneratorArgs {
    pub down: Option<bool>,
    pub middle: Option<bool>,
    pub size: Option<ZalgoSize>,
    pub up: Option<bool>,
}
Expand description

Arguments to provide to Generator::gen and Generator::simple_gen.

§Examples

Instantiating args directly:

use zalgo::{GeneratorArgs, ZalgoSize};
 
GeneratorArgs {
    down: Some(true),
    size: Some(ZalgoSize::Mini),
    ..Default::default()
};

Creating args via GeneratorArgs::new:

use zalgo::{GeneratorArgs, ZalgoSize};
 
GeneratorArgs::new(false, false, true, ZalgoSize::Maxi);

Fields§

§down: Option<bool>

Whether to produce zalgo below the text.

§middle: Option<bool>

Whether to produce zalgo in the middle of the text.

§size: Option<ZalgoSize>

The amount of zalgo to produce.

§up: Option<bool>

Whether to produce zalgo above the text.

Implementations§

Source§

impl GeneratorArgs

Source

pub fn new(up: bool, middle: bool, down: bool, size: ZalgoSize) -> Self

Creates new generator arguments.

Examples found in repository?
examples/gen.rs (line 11)
6fn main() {
7    let mut generator = Generator::new();
8
9    // Create Zalgo text with Zalgo `char`s in all positions, with a maximum
10    // amount of Zalgo:
11    generator.gen("test", &mut String::new(), &GeneratorArgs::new(true, true, true, ZalgoSize::Maxi));
12
13    // Create Zalgo text with Zalgo `char`s in only the middle and lower
14    // positions, with a minimum amount of Zalgo:
15    generator.gen("test", &mut String::new(), &GeneratorArgs::new(false, true, true, ZalgoSize::Mini));
16
17    // Create Zalgo text with Zalgo `char`s in only the lower position, with a
18    // random amount of Zalgo (can be a low amount or high amount):
19    generator.gen("test", &mut String::new(), &GeneratorArgs::new(false, false, true, ZalgoSize::None));
20
21    // Consequentially, you can also not modify your given text with any Zalgo:
22    // Technically the `ZalgoSize` value given does not matter here.
23    generator.gen("test", &mut String::new(), &GeneratorArgs::new(false, false, false, ZalgoSize::None));
24}

Trait Implementations§

Source§

impl Clone for GeneratorArgs

Source§

fn clone(&self) -> GeneratorArgs

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for GeneratorArgs

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for GeneratorArgs

Source§

fn default() -> GeneratorArgs

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.