pub struct FileIO;Expand description
Synchronous, low-overhead file source and sink, backed by StreamConverters over
std::fs::File. Mirrors Akka’s FileIO; see super::TokioFileIO for the async variant.
Implementations§
Source§impl FileIO
impl FileIO
Sourcepub fn from_path(path: impl Into<PathBuf>, chunk_size: usize) -> Source<Vec<u8>>
pub fn from_path(path: impl Into<PathBuf>, chunk_size: usize) -> Source<Vec<u8>>
Reads path into Vec<u8> chunks of at most chunk_size bytes. The file is opened at
materialization; an open failure fails the stream.
Sourcepub fn from_path_default(path: impl Into<PathBuf>) -> Source<Vec<u8>>
pub fn from_path_default(path: impl Into<PathBuf>) -> Source<Vec<u8>>
FileIO::from_path with the default 8 KiB chunk size.
Sourcepub fn to_path(
path: impl Into<PathBuf>,
) -> Sink<Vec<u8>, StreamCompletion<NotUsed>>
pub fn to_path( path: impl Into<PathBuf>, ) -> Sink<Vec<u8>, StreamCompletion<NotUsed>>
Writes the byte stream to path, creating the file if absent and truncating it otherwise.
The materialized StreamCompletion resolves once the file is flushed and closed.
Auto Trait Implementations§
impl Freeze for FileIO
impl RefUnwindSafe for FileIO
impl Send for FileIO
impl Sync for FileIO
impl Unpin for FileIO
impl UnsafeUnpin for FileIO
impl UnwindSafe for FileIO
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
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> Message for T
impl<T> Message for T
Source§fn from_boxed(m: BoxedMessage) -> Result<Self, BoxedDowncastErr>
fn from_boxed(m: BoxedMessage) -> Result<Self, BoxedDowncastErr>
Convert a BoxedMessage to this concrete type
Source§fn box_message(self, pid: &ActorId) -> Result<BoxedMessage, BoxedDowncastErr>
fn box_message(self, pid: &ActorId) -> Result<BoxedMessage, BoxedDowncastErr>
Convert this message to a BoxedMessage