pub struct File<U: Ui> { /* private fields */ }
Expand description
The widget that is used to print and edit files
Implementations§
Source§impl<U: Ui> File<U>
impl<U: Ui> File<U>
Sourcepub fn write(&mut self) -> Result<Option<usize>, Text>
pub fn write(&mut self) -> Result<Option<usize>, Text>
Writes the file to the current PathBuf
, if one was set
Sourcepub fn write_to(&self, path: impl AsRef<Path>) -> Result<Option<usize>>
pub fn write_to(&self, path: impl AsRef<Path>) -> Result<Option<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) -> &[(usize, bool)]
pub fn printed_lines(&self) -> &[(usize, 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.
Sourcepub fn selections(&self) -> &Selections
pub fn selections(&self) -> &Selections
The Selections
that are used on the Text
, if they
exist
Sourcepub fn selections_mut(&mut self) -> Option<&mut Selections>
pub fn selections_mut(&mut self) -> Option<&mut Selections>
A mutable reference to the Selections
, if they exist
Sourcepub fn add_reader(&mut self, pa: &mut Pass, cfg: impl ReaderCfg<U>)
pub fn add_reader(&mut self, pa: &mut Pass, cfg: impl ReaderCfg<U>)
Trait Implementations§
Source§impl<U: Ui> Widget<U> for File<U>
impl<U: Ui> Widget<U> for File<U>
Auto Trait Implementations§
impl<U> Freeze for File<U>
impl<U> !RefUnwindSafe for File<U>
impl<U> !Send for File<U>
impl<U> !Sync for File<U>
impl<U> Unpin for File<U>where
U: Unpin,
impl<U> !UnwindSafe for File<U>
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