pub struct CodeConfig {
pub indent: IndentStyle,
pub auto_indent: bool,
pub line_comment: Option<String>,
pub brackets: Vec<BracketPair>,
pub auto_close_brackets: bool,
pub match_brackets: bool,
}Expand description
Editing behaviour the code editor applies, all supplied by the application.
Fields§
§indent: IndentStyleHow indentation is written and how wide a level is.
auto_indent: boolWhether Enter carries the current line’s leading whitespace onto the new line.
line_comment: Option<String>Token that starts a line comment ("//", "#", "--", ";").
None disables CodeCommand::ToggleLineComment entirely rather than
guessing.
brackets: Vec<BracketPair>Delimiter pairs for auto-closing and match highlighting. Empty disables both.
auto_close_brackets: boolWhether typing an opening delimiter inserts its closing partner.
match_brackets: boolWhether the delimiter matching the caret’s is highlighted.
Implementations§
Source§impl CodeConfig
impl CodeConfig
Sourcepub fn closing_for(&self, open: char) -> Option<char>
pub fn closing_for(&self, open: char) -> Option<char>
The closing partner for open, if it is a configured opening delimiter.
Sourcepub fn opening_for(&self, close: char) -> Option<char>
pub fn opening_for(&self, close: char) -> Option<char>
The opening partner for close, if it is a configured closing delimiter.
Trait Implementations§
Source§impl Clone for CodeConfig
impl Clone for CodeConfig
Source§fn clone(&self) -> CodeConfig
fn clone(&self) -> CodeConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CodeConfig
impl Debug for CodeConfig
Source§impl Default for CodeConfig
impl Default for CodeConfig
Source§fn default() -> Self
fn default() -> Self
The language-neutral default: indent and auto-indent work (they need no
language knowledge), while comment toggling and bracket handling stay
off because they cannot be right without the application saying what
the tokens are. A wrong guess here is worse than nothing — inserting //
into a Python file corrupts it silently.
Auto Trait Implementations§
impl Freeze for CodeConfig
impl RefUnwindSafe for CodeConfig
impl Send for CodeConfig
impl Sync for CodeConfig
impl Unpin for CodeConfig
impl UnsafeUnpin for CodeConfig
impl UnwindSafe for CodeConfig
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
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,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§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.§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.§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.§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.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
impl<T> ErasedDestructor for Twhere
T: 'static,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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>
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>
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