1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
//! Ropey is a utf8 text rope library, designed to be the backing text //! buffer for applications such as text editors. Ropey is fast, //! Unicode-safe, has low memory overhead, and can handle huge texts //! and memory-incoherent edits without trouble. //! //! The library is made up of four main components: //! //! - [`Rope`](struct.Rope.html): the main editable text buffer type. //! - [`RopeSlice`](struct.RopeSlice.html): an immutable view into part //! of a `Rope`. //! - [`RopeBuilder`](struct.RopeBuilder.html): a type for efficiently //! creating `Rope`s from streaming data. //! - [`iter`](iter/index.html): iterators over a `Rope`/`RopeSlice`'s //! data. //! //! # Basic examples //! //! ## Insertion and deletion //! ``` //! use ropey::Rope; //! //! let mut rope = Rope::from_str("Hello individual!"); //! rope.remove(6, 16); //! rope.insert(6, "world"); //! //! assert_eq!(rope, "Hello world!"); //! ``` //! //! ## Slicing //! ``` //! # use ropey::Rope; //! # //! let mut rope = Rope::from_str("Hello individual!"); //! let slice = rope.slice(6, 16); //! //! assert_eq!(slice, "individual"); //! ``` //! //! ## Iterating over lines //! ``` //! # use ropey::Rope; //! # //! let mut rope = Rope::from_str("Hello individual!\nHow are you?"); //! let mut itr = rope.lines(); //! //! assert_eq!(itr.next().unwrap(), "Hello individual!\n"); //! assert_eq!(itr.next().unwrap(), "How are you?"); //! assert_eq!(itr.next(), None); //! ``` #![cfg_attr(feature = "cargo-clippy", allow(inline_always))] #![cfg_attr(feature = "cargo-clippy", allow(needless_return))] extern crate smallvec; extern crate unicode_segmentation; mod tree; mod rope; mod rope_builder; mod slice; mod str_utils; pub mod iter; pub use rope::Rope; pub use rope_builder::RopeBuilder; pub use slice::RopeSlice;