pub struct MemoryFile(/* private fields */);Expand description
A file in memory, given as a handle. When writable, a writer’s writes land only once it finishes, and a writer dropped before abandons them, as the web’s do. Every clone is the same file.
Implementations§
Source§impl MemoryFile
impl MemoryFile
Sourcepub fn new(name: impl Into<String>, bytes: impl Into<Vec<u8>>) -> MemoryFile
pub fn new(name: impl Into<String>, bytes: impl Into<Vec<u8>>) -> MemoryFile
A read-only file named name holding bytes.
Sourcepub fn writable(self) -> MemoryFile
pub fn writable(self) -> MemoryFile
The same file, writable.
Sourcepub fn picked(&self) -> PickedFile
pub fn picked(&self) -> PickedFile
The file as a pick.
Trait Implementations§
Source§impl Clone for MemoryFile
impl Clone for MemoryFile
Source§impl FileHandle for MemoryFile
impl FileHandle for MemoryFile
Source§fn url(&self) -> String
fn url(&self) -> String
memory: and the file’s name, which no system reads: a test’s stand-in for a URL.
fn size(&self) -> FileSizeFuture
Source§fn read_at<'a>(&'a self, offset: u64, buf: &'a mut [u8]) -> FileReadFuture<'a>
fn read_at<'a>(&'a self, offset: u64, buf: &'a mut [u8]) -> FileReadFuture<'a>
Reads into
buf from offset; answers how many bytes it read, 0 at the end.Source§fn open_write(&self) -> Option<FileOpenFuture<Box<dyn FileWriter>>>
fn open_write(&self) -> Option<FileOpenFuture<Box<dyn FileWriter>>>
Opens the file to write;
None unless the pick is writable.Auto Trait Implementations§
impl !RefUnwindSafe for MemoryFile
impl !Send for MemoryFile
impl !Sync for MemoryFile
impl !UnwindSafe for MemoryFile
impl Forget for MemoryFile
impl Freeze for MemoryFilewhere
*const RcInner<MemoryFileState> is !null: Freeze,
PhantomData<RcInner<MemoryFileState>>: Freeze,
impl Move for MemoryFile
impl Unpin for MemoryFile
impl UnsafeUnpin for MemoryFilewhere
*const RcInner<MemoryFileState> is !null: UnsafeUnpin,
PhantomData<RcInner<MemoryFileState>>: UnsafeUnpin,
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