turn room format and room type into enums; transform line endings

This commit is contained in:
2020-04-24 18:06:17 +01:00
parent f4b82c3a67
commit 1c6e3eb515
5 changed files with 87 additions and 13 deletions

View File

@@ -1,4 +1,8 @@
extern crate loe;
use std::io::Cursor;
use radix_fmt::radix_36;
use loe::{process, Config, TransformMode};
pub mod avatar;
pub mod colour;
@@ -96,6 +100,14 @@ fn optional_data_line<T: Display>(label: &str, item: Option<T>) -> String {
}
}
fn transform_line_endings(input: String, mode: TransformMode) -> String {
let mut input = Cursor::new(input);
let mut output = Cursor::new(Vec::new());
process(&mut input, &mut output, Config::default().transform(mode)).unwrap();
String::from_utf8(output.into_inner()).unwrap()
}
#[cfg(test)]
mod test {
use crate::{from_base36, ToBase36, optional_data_line, mock};