pub struct RopeBuilder { /* private fields */ }
Expand description
RopeBuilder provides a mutable container to append bytes/strings. This can also append other Rope instances cheaply, allowing efficient sharing of the contents without a full clone of the bytes.
Implementations§
Source§impl RopeBuilder
impl RopeBuilder
Sourcepub fn push_bytes(&mut self, bytes: &[u8])
pub fn push_bytes(&mut self, bytes: &[u8])
Push owned bytes into the Rope.
If possible use [push_static_bytes] or +=
operation instead, as they
will create a reference to shared memory instead of cloning the bytes.
Sourcepub fn push_static_bytes(&mut self, bytes: &'static [u8])
pub fn push_static_bytes(&mut self, bytes: &'static [u8])
Push static lifetime bytes into the Rope.
This is more efficient than pushing owned bytes, because the internal data does not need to be copied when the rope is read.
Sourcepub fn concat(&mut self, other: &Rope)
pub fn concat(&mut self, other: &Rope)
Concatenate another Rope instance into our builder.
This is much more efficient than pushing actual bytes, since we can share the other Rope’s references without copying the underlying data.
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Trait Implementations§
Source§impl AddAssign<&Rope> for RopeBuilder
impl AddAssign<&Rope> for RopeBuilder
Source§fn add_assign(&mut self, rhs: &Rope)
fn add_assign(&mut self, rhs: &Rope)
+=
operation. Read moreSource§impl AddAssign<&'static str> for RopeBuilder
impl AddAssign<&'static str> for RopeBuilder
Source§fn add_assign(&mut self, rhs: &'static str)
fn add_assign(&mut self, rhs: &'static str)
Pushes a reference to static memory onto the rope.
This is more efficient than pushing owned bytes, because the internal data does not need to be copied when the rope is read.
Source§impl Debug for RopeBuilder
impl Debug for RopeBuilder
Source§impl Default for RopeBuilder
impl Default for RopeBuilder
Source§impl From<&'static str> for RopeBuilder
impl From<&'static str> for RopeBuilder
Source§impl Write for RopeBuilder
impl Write for RopeBuilder
Source§fn write(&mut self, bytes: &[u8]) -> IoResult<usize>
fn write(&mut self, bytes: &[u8]) -> IoResult<usize>
Source§fn flush(&mut self) -> IoResult<()>
fn flush(&mut self) -> IoResult<()>
Source§fn is_write_vectored(&self) -> bool
fn is_write_vectored(&self) -> bool
can_vector
)1.0.0 · Source§fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
Source§fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>
fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>
write_all_vectored
)Auto Trait Implementations§
impl Freeze for RopeBuilder
impl RefUnwindSafe for RopeBuilder
impl Send for RopeBuilder
impl Sync for RopeBuilder
impl Unpin for RopeBuilder
impl UnwindSafe for RopeBuilder
Blanket Implementations§
§impl<T> Any for Twhere
T: Any,
impl<T> Any for Twhere
T: Any,
fn get_type_id(&self) -> TypeId
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more