load_data

Function load_data 

Source
pub fn load_data(data: &str) -> Vec<Vec<&str>>
Expand description

Load the sequential codes from a plain text and returns it.

§Example

use afrim_memory::{Cursor, Node, utils};
use std::rc::Rc;

let text_buffer = Node::default();
let data = utils::load_data(r#"
..a     ä
..af    ɑ̈
..ai    ɛ̈
"#);
data.iter().for_each(|d| { text_buffer.insert(d[0].chars().collect(), d[1].to_owned()); });
let memory = Rc::new(text_buffer);

let mut cursor = Cursor::new(memory, 8);
"..af".chars().for_each(|c| { cursor.hit(c); });

assert_eq!(cursor.state(), (Some("ɑ̈".to_owned()), 4, 'f'));