mod input;
pub mod plugins;
pub enum HardCopySectionContent {
Words(Vec<String>),
Bytes(Vec<u8>),
}
pub struct HardCopySection {
pub name: String,
pub content: HardCopySectionContent,
}
pub struct HardCopy {
pub sections: Vec<HardCopySection>,
}
impl HardCopy {
pub fn new() -> Self {
HardCopy {
sections: Vec::new(),
}
}
pub fn push(&mut self, section: HardCopySection) {
self.sections.push(section);
}
}
pub struct SoftCopy {
pub bytes: Vec<u8>,
}
pub struct HardCopyInput {
words: Vec<String>,
}
impl HardCopyInput {
pub fn new() -> Self {
HardCopyInput { words: Vec::new() }
}
pub fn push_line(&mut self, line: &str) {
let words_part = match line.find(": ") {
Some(idx) => &line[idx + 2..],
None => line,
};
for word in words_part.split_whitespace() {
self.words.push(word.to_string());
}
}
pub fn words(&self) -> &[String] {
&self.words
}
}
pub struct SoftCopyInput {
bytes: Vec<u8>,
}
impl SoftCopyInput {
pub fn from_bytes(bytes: Vec<u8>) -> Self {
SoftCopyInput { bytes }
}
pub fn to_bytes(&self) -> &Vec<u8> {
&self.bytes
}
}