ted 0.1.0

Core text editor functionality.
Documentation
extern crate frappe;
extern crate ropey;

pub mod buffer;
pub mod history;
pub mod cursor;
pub mod jump;

pub use buffer::Buffer;
pub use history::History;
pub use cursor::Cursor;

trait EventSource {
    type Event;

    fn events(&self) -> frappe::Stream<Self::Event>;
}

/// Easier than returning a `std::iter::Map`.
pub struct Samples<'a, T: 'a + Clone> {
    items: &'a [frappe::Signal<T>],
    idx: usize
}

impl<'a, T: 'a + Clone> Iterator for Samples<'a, T> {
    type Item = T;

    fn next(&mut self) -> Option<Self::Item> {
        if self.idx < self.items.len() {
            let item = self.items[self.idx].sample();
            self.idx += 1;
            Some(item)
        } else {
            None
        }
    }
}