pub struct FileView { /* private fields */ }Expand description
A text file, from cx.file_view(path). Its text is read at once and
again when it changes on disk. A clone is cheap and shares it.
Implementations§
Source§impl FileView
impl FileView
Sourcepub fn text(&self) -> ReadSignal<Option<String>>
pub fn text(&self) -> ReadSignal<Option<String>>
The file’s text, or None while it is missing, can’t be read, isn’t
UTF-8, or is over 16 MiB, each logged once until it reads again.
Sourcepub fn write(&self, text: impl AsRef<str>)
pub fn write(&self, text: impl AsRef<str>)
Replaces the file’s text, through a new file beside it renamed over it, so a reader never sees half of it, making its directory if it is missing. A link is followed and the file it names is replaced, keeping its permissions. A failure is logged and the text stays as it was.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for FileView
impl !Send for FileView
impl !Sync for FileView
impl !UnwindSafe for FileView
impl Forget for FileView
impl Freeze for FileView
impl Move for FileView
impl Unpin for FileView
impl UnsafeUnpin for FileView
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