Struct fuse_backend_rs::common::file_buf::FileVolatileBuf
source · 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§
source§impl FileVolatileBuf
impl FileVolatileBuf
sourcepub unsafe fn new(buf: &mut [u8]) -> Self
pub unsafe fn new(buf: &mut [u8]) -> Self
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.
sourcepub unsafe fn new_with_data(buf: &mut [u8], size: usize) -> Self
pub unsafe fn new_with_data(buf: &mut [u8], size: usize) -> Self
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()
.
sourcepub unsafe fn from_raw_ptr(addr: *mut u8, size: usize, cap: usize) -> Self
pub unsafe fn from_raw_ptr(addr: *mut u8, size: usize, cap: usize) -> Self
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
.
sourcepub fn io_slice_mut(&self) -> IoSliceMut<'_>
pub fn io_slice_mut(&self) -> IoSliceMut<'_>
Generate an IoSliceMut
object to write data into the buffer.
Trait Implementations§
source§impl Clone for FileVolatileBuf
impl Clone for FileVolatileBuf
source§fn clone(&self) -> FileVolatileBuf
fn clone(&self) -> FileVolatileBuf
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for FileVolatileBuf
impl Debug for FileVolatileBuf
impl Copy for FileVolatileBuf
Auto Trait Implementations§
impl Freeze for FileVolatileBuf
impl RefUnwindSafe for FileVolatileBuf
impl Send for FileVolatileBuf
impl Sync for FileVolatileBuf
impl Unpin for FileVolatileBuf
impl UnwindSafe for FileVolatileBuf
Blanket Implementations§
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<T> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)