chore: format
This commit is contained in:
parent
74512ffdb2
commit
d211387420
4 changed files with 24 additions and 23 deletions
16
src/core.rs
16
src/core.rs
|
|
@ -1,11 +1,11 @@
|
|||
//! Handles conversion one letter at a time for any base
|
||||
// based off this SO answer: https://stackoverflow.com/a/1119769
|
||||
/// Converts a [`u32`] to catspeak
|
||||
///
|
||||
///
|
||||
/// ```
|
||||
/// use cat2text::core::num_to_cat;
|
||||
/// use cat2text::base4::{alphabet, char_length};
|
||||
///
|
||||
///
|
||||
/// assert_eq!("meow mreow mrrp".to_string(), num_to_cat(9, alphabet(), char_length()));
|
||||
/// ```
|
||||
pub fn num_to_cat(num: u32, alphabet: Vec<String>, char_length: u32) -> String {
|
||||
|
|
@ -29,13 +29,13 @@ pub fn num_to_cat(num: u32, alphabet: Vec<String>, char_length: u32) -> String {
|
|||
}
|
||||
|
||||
/// Converts catspeak to a [`u32`]
|
||||
///
|
||||
///
|
||||
/// ```
|
||||
/// use cat2text::core::cat_to_num;
|
||||
/// use cat2text::base4::{alphabet, char_length};
|
||||
///
|
||||
///
|
||||
/// let letter = vec!["meow".to_string(), "mreow".to_string(), "mrrp".to_string()];
|
||||
///
|
||||
///
|
||||
/// assert_eq!(9, cat_to_num(letter, alphabet(), char_length()));
|
||||
/// ```
|
||||
pub fn cat_to_num(text: Vec<String>, alphabet: Vec<String>, char_length: u32) -> u32 {
|
||||
|
|
@ -59,10 +59,10 @@ pub fn cat_to_num(text: Vec<String>, alphabet: Vec<String>, char_length: u32) ->
|
|||
}
|
||||
|
||||
/// Splits a cat word into every 3 segments
|
||||
///
|
||||
///
|
||||
/// ```
|
||||
/// use cat2text::core::split_every_3;
|
||||
///
|
||||
///
|
||||
/// assert_eq!(vec!["meow meow mrrp".to_string(), "meow mreow mrrp".to_string(), "mreow meow mrrp".to_string()], split_every_3("meow meow mrrp meow mreow mrrp mreow meow mrrp".to_string()));
|
||||
/// ```
|
||||
pub fn split_every_3(text: String) -> Vec<String> {
|
||||
|
|
@ -79,4 +79,4 @@ pub fn split_every_3(text: String) -> Vec<String> {
|
|||
}
|
||||
}
|
||||
return output;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue