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

An adapter structure to support io-uring based asynchronous IO.

The tokio-uring framework needs to take ownership of data buffers during asynchronous IO operations. The FileVolatileBuf converts a referenced buffer to a buffer compatible with the tokio-uring APIs.

Safety

The buffer is borrowed without a lifetime parameter, so the caller must ensure that the FileVolatileBuf object doesn’t out-live the borrowed buffer. And during the lifetime of the FileVolatileBuf object, the referenced buffer must be stable.

Implementations§

Create a FileVolatileBuf object from a mutable slice, eliding the lifetime associated with the slice.

Safety

The caller needs to guarantee that the returned FileVolatileBuf object doesn’t out-live the referenced buffer. The caller must also guarantee that all other users of the given chunk of memory are using volatile accesses.

Create a FileVolatileBuf object containing size bytes of initialized data from a mutable slice, eliding the lifetime associated with the slice.

Safety

The caller needs to guarantee that the returned FileVolatileBuf object doesn’t out-live the referenced buffer. The caller must also guarantee that all other users of the given chunk of memory are using volatile accesses.

Panic

Panic if size is bigger than buf.len().

Create a FileVolatileBuf object from a raw pointer.

Safety

The caller needs to guarantee that the returned FileVolatileBuf object doesn’t out-live the referenced buffer. The caller must also guarantee that all other users of the given chunk of memory are using volatile accesses.

Panic

Panic if size is bigger than cap.

Generate an IoSlice object to read data from the buffer.

Generate an IoSliceMut object to write data into the buffer.

Get capacity of the buffer.

Check whether the buffer is empty.

Get size of initialized data in the buffer.

Set size of initialized data in the buffer.

Safety

Caller needs to ensure size is less than or equal to cap.

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Returns a raw pointer to the vector’s buffer. Read more
Number of initialized bytes. Read more
Total size of the buffer, including uninitialized memory, if any. Read more
Returns a view of the buffer with the specified range. Read more
Returns a raw mutable pointer to the vector’s buffer. Read more
Updates the number of initialized bytes. Read more

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
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.