pub struct PtrBuffer { /* private fields */ }
Expand description

A Buffer object backed by a pointer/size pair. Use this buffer type when accessing unowned memory or arbitrary allocated memory.

Implementations

Create a new buffer object with a given pointer and size. Just make sure the pointer outlives the object and not the other way around.

Set the new pointer of this buffer.

Set the new size of this buffer.

Create a new PtrBuffer object within the bounds of the current buffer.

Split this buffer into two separate buffers at the given splitpoint mid.

Returns an Error::OutOfBounds error if this split goes out of bounds of the buffer.

Trait Implementations

Converts this type into a mutable reference of the (usually inferred) input type.

Converts this type into a shared reference of the (usually inferred) input type.

Get the length of this PtrBuffer object.

Get the PtrBuffer object as a pointer.

Get the PtrBuffer object as a mutable pointer.

Get the PtrBuffer object as a slice.

Get the PtrBuffer object as a mutable slice.

Get a pointer to the end of the buffer. Read more

Get a pointer range of this buffer. See slice::as_ptr_range for more details.

Get a mutable pointer range of this buffer. See slice::as_mut_ptr_range for more details.

Check whether or not this buffer is empty.

Validate that the given pointer object is within the range of this buffer.

Convert an offset to a u8 pointer. Read more

Convert an offset to a mutable u8 pointer. Read more

Convert a pointer to an offset into the buffer. Read more

Convert a given reference to an object into an offset into the buffer. Read more

Convert a given slice reference to an offset into the buffer. Read more

Convert this buffer to a u8 Vec object.

Swap two bytes at the given offsets. This panics if the offsets are out of bounds. See slice::swap for more details. Read more

Reverse the buffer. See slice::reverse for more details.

Return an iterator object (BufferIter) into the buffer.

Return a mutable iterator object (BufferIterMut) into the buffer.

Save this buffer to disk.

Get the given byte or range of bytes from the buffer. See slice::get for more details.

Get the given byte or range of bytes from the buffer as mutable. See slice::get_mut for more details.

Get a reference to a given object within the buffer. Typically the main interface by which objects are retrieved. Read more

Get a reference to a given object within the buffer, but in an unaligned way. Read more

Get a reference regardless of potential alignment issues. Read more

Get a mutable reference to a given object within the buffer. See Buffer::get_ref.

Get a mutable reference to a given object within the buffer, but in an unaligned way. Read more

Get a mutable reference regardless of potential alignment issues. Read more

Convert a given reference to a mutable reference within the buffer. Read more

Convert a given reference to a mutable reference without alignment guarantees. Read more

Convert an object to a mutable reference regardless of potential alignment issues. Read more

Gets a slice reference of type T at the given offset with the given size. Read more

Gets a slice ref of type T at the given offset regardless of potential alignment issues. Read more

Get a slice reference regardless of potential alignment issues. Read more

Gets a mutable slice reference of type T at the given offset with the given size. See Buffer::get_slice_ref. Read more

Gets a mutable slice reference of type T at the given offset with the given size, but without alignment checking. See Buffer::get_slice_ref_unaligned. Read more

Get a mutable slice reference regardless of potential alignment issues. Read more

Convert a given slice reference to a mutable slice reference within the buffer. Read more

Convert a given slice reference to a mutable slice reference without alignment guarantees. Read more

Convert an object to a mutable reference regardless of potential alignment issues. Read more

Read an arbitrary size amount of bytes from the given offset. Read more

Read an arbitrary size amount of bytes from the given offset, but mutable. Read more

Write an arbitrary u8 slice to the given offset. Read more

Write a given object of type T to the given buffer at the given offset. Read more

Write a given slice object of type T to the given buffer at the given offset. Read more

Start the buffer object with the given byte data. Read more

Start the buffer with the given reference data. Read more

Start the buffer with the given slice reference data. Read more

End the buffer object with the given byte data. Read more

End the buffer with the given reference data. Read more

End the buffer with the given slice reference data. Read more

Search for the given u8 slice data within the given buffer. Read more

Search for the following reference of type T. This converts the object into a u8 slice. See Buffer::search. Read more

Search for the following slice reference of type T. This converts the slice into a u8 slice. See Buffer::search. Read more

Check if this buffer contains the following u8 slice sequence.

Check if this buffer contains the following object of type T.

Check if this buffer contains the following slice of type T.

Check if this buffer starts with the byte sequence needle. See slice::starts_with.

Check if this buffer ends with the byte sequence needle. See slice::ends_with.

Rotate the buffer left at midpoint mid. See slice::rotate_left.

Rotate the buffer right at midpoint mid. See slice::rotate_right.

Fill the given buffer with the given value. See slice::fill.

Fill the given buffer with the given closure f. See slice::fill_with.

Clone the given u8 slice data src into the given buffer.

Copy the given u8 slice data src into the given buffer.

Copy from within the given buffer. See slice::copy_within.

Swap the data in this buffer with the given u8 slice reference.

Check if this buffer is ASCII. See slice::is_ascii.

Check if this buffer is equal while ignoring case of letters. See slice::eq_ignore_ascii_case.

Make this buffer ASCII uppercase. See slice::make_ascii_uppercase.

Make this buffer ASCII lowercase. See slice::make_ascii_lowercase.

Sort this buffer. See slice::sort.

Sort by the given closure comparing each individual byte. See slice::sort_by.

Sorts the slice with a key extraction function. See slice::sort_by_key.

Creates a new Buffer object by repeating the current buffer n times. See slice::repeat.

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

The returned type after indexing.

Performs the indexing (container[index]) operation. Read more

Performs the mutable indexing (container[index]) operation. Read more

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

Creates an iterator from a value. Read more

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

This method tests for !=.

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

This method tests for !=.

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

This method tests for !=.

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

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.