pub struct EditBuffer { /* private fields */ }
Implementations§
Source§impl EditBuffer
impl EditBuffer
Sourcepub fn new(text: &str, cursor: (usize, usize)) -> Self
pub fn new(text: &str, cursor: (usize, usize)) -> Self
Examples found in repository?
examples/textbox-rs.rs (line 124)
120fn main() {
121 let (mut app, event_loop): (App<TextState, BasicApp>, winit::event_loop::EventLoop<()>) =
122 App::new(
123 TextState {
124 text: EditBuffer::new("new text", (0, 0)).into(),
125 },
126 vec![],
127 BasicApp {},
128 |_| (),
129 )
130 .unwrap();
131
132 event_loop.run_app(&mut app).unwrap();
133}
pub fn get_content(&self) -> String
pub fn set_content(&self, content: &str)
pub fn edit( &self, multisplice: &[(Range<usize>, String)], ) -> SmallVec<[(Range<usize>, String); 1]>
pub fn get_cursor(&self) -> (usize, Affinity)
pub fn get_selection(&self) -> (usize, Affinity)
pub fn set_cursor(&self, cursor: usize, affinity: Affinity)
pub fn set_selection(&self, start: (usize, Affinity), end: (usize, Affinity))
pub fn to_cursor(buffer: &Buffer, cursor: (usize, Affinity)) -> Cursor
pub fn from_cursor(buffer: &Buffer, cursor: Cursor) -> (usize, Affinity)
pub fn flowtext( &self, font_system: &mut FontSystem, font_size: f32, line_height: f32, wrap: Wrap, dpi: Vec2, attrs: Attrs<'_>, )
Trait Implementations§
Source§impl Clone for EditBuffer
impl Clone for EditBuffer
Source§impl Debug for EditBuffer
impl Debug for EditBuffer
Source§impl Default for EditBuffer
impl Default for EditBuffer
Source§impl From<EditBuffer> for EditView
impl From<EditBuffer> for EditView
Source§fn from(value: EditBuffer) -> Self
fn from(value: EditBuffer) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl !Freeze for EditBuffer
impl !RefUnwindSafe for EditBuffer
impl !Send for EditBuffer
impl !Sync for EditBuffer
impl Unpin for EditBuffer
impl !UnwindSafe for EditBuffer
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
Convert
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>
Convert
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)
Convert
&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)
Convert
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more