Struct ropey::RopeBuilder
source · [−]pub struct RopeBuilder { /* private fields */ }
Expand description
An efficient incremental Rope
builder.
This is used to efficiently build ropes from sequences of text chunks. It is useful for creating ropes from:
- …large text files, without pre-loading their entire contents into
memory (but see
from_reader()
for a convenience function that does this for casual use-cases). - …streaming data sources.
- …non-utf8 text data, doing the encoding conversion incrementally as you go.
Unlike repeatedly calling Rope::insert()
on the end of a rope,
this API runs in time linear to the amount of data fed to it, and
is overall much faster.
Example
let mut builder = RopeBuilder::new();
builder.append("Hello ");
builder.append("world!\n");
builder.append("How's ");
builder.append("it goin");
builder.append("g?");
let rope = builder.finish();
assert_eq!(rope, "Hello world!\nHow's it going?");
Implementations
sourceimpl RopeBuilder
impl RopeBuilder
Trait Implementations
sourceimpl Clone for RopeBuilder
impl Clone for RopeBuilder
sourcefn clone(&self) -> RopeBuilder
fn clone(&self) -> RopeBuilder
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for RopeBuilder
impl Debug for RopeBuilder
sourceimpl Default for RopeBuilder
impl Default for RopeBuilder
sourcefn default() -> RopeBuilder
fn default() -> RopeBuilder
Returns the “default value” for a type. Read more
Auto Trait Implementations
impl RefUnwindSafe for RopeBuilder
impl Send for RopeBuilder
impl Sync for RopeBuilder
impl Unpin for RopeBuilder
impl UnwindSafe for RopeBuilder
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more