Struct LoremRustum

Source
pub struct LoremRustum {
    pub body: Vec<&'static str>,
    pub length: usize,
}

Fields§

§body: Vec<&'static str>§length: usize

Implementations§

Source§

impl LoremRustum

Source

pub fn new(length: usize) -> LoremRustum

Build LoremRustum struct with specified length by choosing random elements from RUSTY_PHRASES using rand::thread_rng().

§Examples
let lorem = lorem_rustum::LoremRustum::new(42);
println!("{}", lorem.to_string());
§Rusty Phrases:
pub static RUSTY_PHRASES: [&str; 132] = [
    "rust", "borrowing", "tokio", "async", "unsafe", "thread", "trait", "&str",
    "rust-analyzer", "scope", "await", "ryan", "ownership", "safety", "nightly",
    "allocated", "rustlings", "stack", "heap", "no garbage collector", "runtime",
    "macros", "code execution", "fmt", "clippy", "memory safe", "cargo", "built-in",
    "performance", "golang sucks", "better than c++", "friendly community",
    "loved by developers", "wasm", "webassembly", "actix", "axum", "rocket", "yew",
    "diesel", "sqlx", "pub", "mod", "enum", "static", "missing lifetime", "rusty",
    "the most admired language", "a safer alternative to C and C++", "cargo package manager",
    "performance-critical services", "Ferris mascot", "fast and reliable", "control over memory allocation",
    "deallocation", "deref", "derive", "impl", "implement trait for", "to_owned()",
    "i'm not looking for a job", "<'static>", "mut", "&mut", "efficient and organized development workflows",
    "concurrency", "multiple threads can work on shared data without introducing memory-related issues",
    "low-level tools and kernels", "type checking", "unwrap", "please gouge out my eyes",
    "Sync + Send", "thread safety", "spawn concurrent task", "non-blocking i/o",
    "smart pointer", "<'a>", "cargo test", "async-std", "println!", "dbg!", "dyn",
    "stderr", "mpsc", "async move", "Arc", "Rc", "RefCell", "Box", "||", "expect",
    "map", "making", "building", "produce", "consume", "out of scope", "rustc",
    "rustup", "panic", "generics", "<T>", "impl fmt::Display for", "macro",
    "#[derive()]", "multiple bounds", "traits", "macro_rules!", "Some()", "Option<&T>",
    "None", "RAII", "drop", "destructor", "mutability of data", "ref", "as",
    "closures", "HOF", "Higher Order Functions", "lazy loading", "err", "error",
    "Result<T, Error>", "()", "Err(_)", "std", "#[cfg(test)]", "assert!",
    "cargo run", "publish crate", "code blocks below"
];
Source

pub fn shuffle(&mut self)

Shuffle body of LoremRustum in place using shuffle() from rand crate.

§Examples
let mut lorem = lorem_rustum::LoremRustum::default();
let text = lorem.to_string();

lorem.shuffle();
let new_text = lorem.to_string();

assert_ne!(text, new_text);

Trait Implementations§

Source§

impl Clone for LoremRustum

Source§

fn clone(&self) -> LoremRustum

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 LoremRustum

Source§

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

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

impl Default for LoremRustum

Source§

fn default() -> Self

Build LoremRustum with all RUSTY_PHRASES (contains 132 phrases).

§Examples
let lorem = lorem_rustum::LoremRustum::default();
println!("{}", lorem.to_string());
Source§

impl PartialEq for LoremRustum

Source§

fn eq(&self, other: &LoremRustum) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl ToString for LoremRustum

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl StructuralPartialEq for LoremRustum

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V