pub enum IndentStyle {
Spaces(u8),
Tab,
}Expand description
Indentation style used when pressing the Tab key.
Controls whether indentation inserts spaces or a tab character.
Implements Display with a human-readable label
("4 spaces", "Tab"), so it can be dropped straight into a settings
picker.
§Examples
use iced_code_editor::{CodeEditor, IndentStyle};
let mut editor = CodeEditor::new("fn main() {}", "rs");
assert_eq!(editor.indent_style(), IndentStyle::Spaces(4));
editor.set_indent_style(IndentStyle::Tab);
assert_eq!(editor.indent_style().to_string(), "Tab");
assert_eq!(IndentStyle::Spaces(2).to_string(), "2 spaces");Variants§
Implementations§
Source§impl IndentStyle
impl IndentStyle
Sourcepub const ALL: [IndentStyle; 4]
pub const ALL: [IndentStyle; 4]
All standard indentation styles available for selection.
Iterate this to build a settings picker, rather than hardcoding the list at each call site.
§Examples
use iced_code_editor::IndentStyle;
let labels: Vec<String> =
IndentStyle::ALL.iter().map(ToString::to_string).collect();
assert_eq!(labels, ["2 spaces", "4 spaces", "8 spaces", "Tab"]);Trait Implementations§
Source§impl Clone for IndentStyle
impl Clone for IndentStyle
impl Copy for IndentStyle
Source§impl Debug for IndentStyle
impl Debug for IndentStyle
Source§impl Display for IndentStyle
impl Display for IndentStyle
impl Eq for IndentStyle
Source§impl From<IndentStyle> for LspFormattingOptions
impl From<IndentStyle> for LspFormattingOptions
Source§fn from(style: IndentStyle) -> Self
fn from(style: IndentStyle) -> Self
Derives formatting options from the editor’s indentation style.
IndentStyle::Tab reports the editor’s own rendered tab width, which
is what the server needs to lay out alignment inside a tab-indented
file. A zero-width spaces style — which no built-in preset produces —
is raised to 1, since tabSize: 0 is not a value any server can act on.
§Example
use iced_code_editor::{IndentStyle, LspFormattingOptions};
let options = LspFormattingOptions::from(IndentStyle::Tab);
assert!(!options.insert_spaces);Source§impl PartialEq for IndentStyle
impl PartialEq for IndentStyle
impl StructuralPartialEq for IndentStyle
Auto Trait Implementations§
impl Forget for IndentStyle
impl Freeze for IndentStyle
impl RefUnwindSafe for IndentStyle
impl Send for IndentStyle
impl Sync for IndentStyle
impl Unpin for IndentStyle
impl UnsafeUnpin for IndentStyle
impl UnwindSafe for IndentStyle
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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<State, Message> IntoBoot<State, Message> for State
impl<State, Message> IntoBoot<State, Message> for State
Source§fn into_boot(self) -> (State, Task<Message>)
fn into_boot(self) -> (State, Task<Message>)
Turns some type into the initial state of some
Application.