pub struct Buffer {
pub opts: PrintOpts,
/* private fields */
}Expand description
The widget that is used to print and edit buffers
Fields§
§opts: PrintOptsYou can use this member to change the way this Buffer will
be printed specifically.
Implementations§
Source§impl Buffer
impl Buffer
Sourcepub fn path(&self) -> String
pub fn path(&self) -> String
The full path of the buffer.
If there is no set path, returns "*scratch buffer*#{id}".
Sourcepub fn path_set(&self) -> Option<String>
pub fn path_set(&self) -> Option<String>
The full path of the buffer.
Returns None if the path has not been set yet, i.e., if
the buffer is a scratch buffer.
Sourcepub fn name(&self) -> String
pub fn name(&self) -> String
The buffer’s name.
If there is no set path, returns "*scratch buffer #{id}*".
Sourcepub fn name_set(&self) -> Option<String>
pub fn name_set(&self) -> Option<String>
The buffer’s name.
Returns None if the path has not been set yet, i.e., if
the buffer is a scratch buffer.
Sourcepub fn name_txt(&self) -> Text
pub fn name_txt(&self) -> Text
A Text from the name of this PathKind
The name of a Buffer widget is the same as the path, but
it strips away the current directory. If it can’t, it will
try to strip away the home directory, replacing it with
"~". If that also fails, it will just show the full
path.
§Formatting
If the buffer’s name was set:
[buffer]{name}If the buffer’s name was not set:
[buffer.new.scratch]*scratch buffer #{id}*Sourcepub fn path_kind(&self) -> PathKind
pub fn path_kind(&self) -> PathKind
The type of PathBuf
This represents the three possible states for a Buffer’s
PathBuf, as it could either represent a real Buffer,
not exist, or not have been defined yet.
Sourcepub fn selections(&self) -> &Selections
pub fn selections(&self) -> &Selections
The Selections that are used on the Text
Sourcepub fn selections_mut(&mut self) -> &mut Selections
pub fn selections_mut(&mut self) -> &mut Selections
A mutable reference to the Selections
Trait Implementations§
Source§impl Widget for Buffer
impl Widget for Buffer
Source§fn needs_update(&self, _: &Pass) -> bool
fn needs_update(&self, _: &Pass) -> bool
Source§fn get_print_opts(&self) -> PrintOpts
fn get_print_opts(&self) -> PrintOpts
Source§fn on_mouse_event(pa: &mut Pass, handle: &Handle<Self>, event: MouseEvent)
fn on_mouse_event(pa: &mut Pass, handle: &Handle<Self>, event: MouseEvent)
MouseEvent Read moreAuto Trait Implementations§
impl !Freeze for Buffer
impl !RefUnwindSafe for Buffer
impl Send for Buffer
impl Sync for Buffer
impl Unpin for Buffer
impl !UnwindSafe for Buffer
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
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.