Struct byte_str::ByteString [] [src]

pub struct ByteString { /* fields omitted */ }

and Vec<u8>.

Methods

impl ByteString
[src]

[src]

Creates a new empty ByteString without allocating any memory.

[src]

Converts a vector of bytes into a ByteString without clones or allocation.

[src]

Creates a ByteString from a slice.

[src]

Returns a reference to the underlying byte vector.

[src]

Returns a mutable reference to the underlying byte vector.

[src]

Converts self into a vector without clones or allocation.

[src]

Converts self into a boxed slice, dropping any excess capacity.

[src]

Converts self into a boxed ByteStr, dropping any excess capacity.

[src]

Returns a ByteStr containing the entiere string.

[src]

Returns a mutable ByteStr containing the entiere string.

[src]

Returns the number of byte the string can hold without reallocating.

[src]

Reserves capacity for at least additional more bytes to be inserted into self.

[src]

Reserves the minimum capacity for exactly additional more elements to be inserted into self.

[src]

Shrinks the capacity of the string as much as possible.

[src]

Shortens the string, keeping the first len bytes.

[src]

Clears the vector, removing all values and keeping the capacity of the string.

[src]

Sets the length of a vector.

This will explicitly set the size of the vector, without actually modifying its buffers, so it is up to the caller to ensure that the vector is actually the specified size.

[src]

Removes an element from the vector and returns it.

The removed element is replaced by the last element of the vector.

This does not preserve ordering, but is O(1).

Panics

Panics if index is out of bounds.

[src]

Inserts an element at position index within the string, shifting all elements after it to the right.

Panics

Panics if index is out of bounds.

[src]

Removes and returns the element at position index within the string, shifting all elements after it to the left.

Panics

Panics if index is out of bounds.

[src]

Retains only the elements specified by the predicate.

[src]

Removes all but the first of consecutive elements in the string that resolve to the same key.

Similar to Vec::dedup_by_key().

[src]

Removes all but the first of consecutive elements in the string satisfying a given equality relation.

Similar to Vec::dedup_by().

[src]

Removes consecutive repeated elements in the vector.

If the vector is sorted, this removes all duplicates.

[src]

Appends an element to the back of the string.

[src]

Removes the last element from a string and returns it, or None if it is empty.

[src]

Appends a slice to the back of the string.

[src]

Appends a ByteStr to the back of the string.

[src]

Inserts a slice at position index within the string, shifting all elements after it to the right.

Panics

Panics if index is out of bounds.

[src]

Inserts a ByteStr at position index within the string, shifting all elements after it to the right.

Panics

Panics if index is out of bounds.

[src]

Creates a draining iterator that removes the specified range in the vector and yields the removed items.

[src]

Splits the string into two at the given index.

Returns a newly allocated ByteString. self contains elements [0, at), and the returned ByteString contains elements [at, len).

Panics

Panics if at > len.

Methods from Deref<Target = ByteStr>

[src]

Converts self into a byte slice.

[src]

Converts self into a mutable byte slice.

[src]

Copies the self into a Vec.

[src]

Copies the self into a ByteString.

[src]

Returns the length of self.

[src]

Returns true if the length of self is zero.

[src]

Converts self into a raw pointer that points to the first byte of the string.

[src]

Converts self into a mutable raw pointer that points to the first byte of the string.

[src]

Returns a reference to an element of the slice, or None if the index is out of bounds.

[src]

Returns a mutable reference to an element of the slice, or None if the index is out of bounds.

[src]

Returns a reference to the first byte of the string, or None if it is empty.

[src]

Returns a mutable reference to the first byte of the string, or None if it is empty.

[src]

Returns a reference to the last byte of the string, or None if it is empty.

[src]

Returns a mutable reference to the last byte of the string, or None if it is empty.

[src]

Returns the first and all the rest of the bytes of the slice, or None if it is empty.

[src]

Returns the first and all the rest of the bytes of the slice, or None if it is empty.

[src]

Returns the last and all the rest of the bytes of the slice, or None if it is empty.

[src]

Returns the last and all the rest of the bytes of the slice, or None if it is empty.

[src]

Returns an iterator over the string.

[src]

Returns an iterator that allows modifying each value.

[src]

Returns an iterator over all contiguous windows of length size. The windows overlap. If the string is shorter than size, the iterator returns no values.

Similar to slice::windows().

[src]

Returns an iterator over size bytes of the string at a time. The chunks do not overlap. If size does not divide the length of the slice, then the last chunk will not have length size.

Similar to slice::chunks().

[src]

Returns an iterator over size elements of the slice at a time. The chunks are mutable strings and do not overlap. If size does not divide the length of the slice, then the last chunk will not have length size.

Similar to slice::chunks_mut().

[src]

Divides one string into two at an index.

The first will contain all indices from [0, mid) (excluding the index mid itself) and the second will contain all indices from [mid, len) (excluding the index len itself).

Similar to slice::split_at().

Panics

Panics if mid > len.

[src]

Divides one &mut string into two at an index.

The first will contain all indices from [0, mid) (excluding the index mid itself) and the second will contain all indices from [mid, len) (excluding the index len itself).

Similar to slice::split_at_mut().

Panics

Panics if mid > len.

[src]

Returns an iterator over substrings of this string, separated by a matcher.

[src]

Returns an iterator over mutable substrings of this string, separated by a matcher.

[src]

Returns an iterator over substrings of this string, separated by a matcher, starting at the end of the slice and working backwards.

[src]

Returns an iterator over mutable substrings of this string, separated by a matcher, starting at the end of the slice and working backwards.

[src]

Returns an iterator over substrings of this string, separated by a matcher, returning at most n items.

If n substrings are returned, the last substring will contain the remainder of the string.

[src]

Returns an iterator over mutable substrings of this string, separated by a matcher, returning at most n items.

If n substrings are returned, the last substring will contain the remainder of the string.

[src]

Returns an iterator over substrings of this string, separated by a matcher and stating from the end of the string, returning at most n items.

If n substrings are returned, the last substring will contain the remainder of the string.

[src]

Returns an iterator over mutable substrings of this string, separated by a matcher and stating from the end of the string, returning at most n items.

If n substrings are returned, the last substring will contain the remainder of the string.

[src]

Returns an iterator over the disjoint matches within the given string.

[src]

Returns an iterator over the mutable disjoint matches within the given string.

[src]

Returns an iterator over the disjoint matches within the given string, yielded in reverse order.

[src]

Returns an iterator over the mutable disjoint matches within the given string, yielded in reverse order.

[src]

Returns an iterator over the disjoint matches within the given string, as well as the index that the match starts at.

[src]

Returns an iterator over the mutable disjoint matches within the given string, as well as the index that the match starts at.

[src]

Returns an iterator over the disjoint matches within the given string, yielded in reverse order, as well as the index that the match starts at.

[src]

Returns an iterator over the mutable disjoint matches within the given string, yielded in reverse order, as well as the index that the match starts at.

[src]

Returns true if the string contains a substring that matches the given matcher.

[src]

Returns true if the string beginning a matches the given matcher.

[src]

Returns true if the string ending a matches the given matcher.

[src]

Returns the byte index of the first character of self that matches the matcher or None it it doesn't match.

[src]

Returns the byte index of the last character of self that matches the matcher or None it it doesn't match.

[src]

Swaps two bytes in the string, indexed by a and b.

Panics

Panics if a or b are out of bounds.

[src]

Reverses the order of bytes in the slice.

[src]

Copies all elements from src into self, using a memcpy.

The length of src must be the same as self.

[src]

Copies all elements from src into self, using a memcpy.

The length of src must be the same as self.

Trait Implementations

impl Clone for ByteString
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl Default for ByteString
[src]

[src]

Returns the "default value" for a type. Read more

impl PartialEq for ByteString
[src]

[src]

This method tests for self and other values to be equal, and is used by ==. Read more

[src]

This method tests for !=.

impl Eq for ByteString
[src]

impl<'a> From<&'a [u8]> for ByteString
[src]

[src]

Performs the conversion.

impl<'a> From<&'a ByteStr> for ByteString
[src]

[src]

Performs the conversion.

impl<'a> From<&'a str> for ByteString
[src]

[src]

Performs the conversion.

impl From<Vec<u8>> for ByteString
[src]

[src]

Performs the conversion.

impl From<Box<[u8]>> for ByteString
[src]

[src]

Performs the conversion.

impl From<Box<ByteStr>> for ByteString
[src]

[src]

Performs the conversion.

impl From<Box<str>> for ByteString
[src]

[src]

Performs the conversion.

impl From<String> for ByteString
[src]

[src]

Performs the conversion.

impl FromIterator<u8> for ByteString
[src]

[src]

Creates a value from an iterator. Read more

impl Debug for ByteString
[src]

[src]

Formats the value using the given formatter.

impl Deref for ByteString
[src]

The resulting type after dereferencing.

[src]

Dereferences the value.

impl DerefMut for ByteString
[src]

[src]

Mutably dereferences the value.

impl Borrow<ByteStr> for ByteString
[src]

[src]

Immutably borrows from an owned value. Read more

impl BorrowMut<ByteStr> for ByteString
[src]

[src]

Mutably borrows from an owned value. Read more

impl Borrow<[u8]> for ByteString
[src]

[src]

Immutably borrows from an owned value. Read more

impl BorrowMut<[u8]> for ByteString
[src]

[src]

Mutably borrows from an owned value. Read more

impl AsRef<ByteStr> for ByteString
[src]

[src]

Performs the conversion.

impl AsRef<[u8]> for ByteString
[src]

[src]

Performs the conversion.

impl AsMut<ByteStr> for ByteString
[src]

[src]

Performs the conversion.

impl AsMut<[u8]> for ByteString
[src]

[src]

Performs the conversion.