pub struct File { /* private fields */ }Expand description
The widget that is used to print and edit files
Implementations§
Source§impl File
impl File
Sourcepub fn write(&self) -> Result<usize, String>
pub fn write(&self) -> Result<usize, String>
Writes the file to the current Path, if one was set
Sourcepub fn write_to(&self, path: impl AsRef<str>) -> Result<usize>
pub fn write_to(&self, path: impl AsRef<str>) -> Result<usize>
Writes the file to the given Path
Sourcepub fn path(&self) -> String
pub fn path(&self) -> String
The full path of the file.
If there is no set path, returns "*scratch file*#{id}".
Sourcepub fn path_set(&self) -> Option<String>
pub fn path_set(&self) -> Option<String>
The full path of the file.
Returns None if the path has not been set yet.
Sourcepub fn name(&self) -> String
pub fn name(&self) -> String
The file’s name.
If there is no set path, returns "*scratch file #{id}*".
Sourcepub fn name_set(&self) -> Option<String>
pub fn name_set(&self) -> Option<String>
The file’s name.
Returns None if the path has not been set yet.
Sourcepub fn printed_lines(&self) -> &[(u32, bool)]
pub fn printed_lines(&self) -> &[(u32, bool)]
Returns the currently printed set of lines.
These are returned as a usize, showing the index of the line
in the file, and a bool, which is true when the line is
wrapped.
pub fn text_mut(&mut self) -> &mut Text
Trait Implementations§
Auto Trait Implementations§
impl Freeze for File
impl !RefUnwindSafe for File
impl Send for File
impl Sync for File
impl Unpin for File
impl !UnwindSafe for File
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