pub struct Indentation {
pub step: &'static str,
/* private fields */
}Expand description
How a language indents: its step, and the lines that open and close a block.
Fields§
§step: &'static strImplementations§
Source§impl Indentation
impl Indentation
Sourcepub fn of(language: Language, source: &str) -> Indentation
pub fn of(language: Language, source: &str) -> Indentation
The indentation language follows; Hardware by what source is, Verilog or a spec.
Sourcepub fn opens_block(&self, line: &str) -> bool
pub fn opens_block(&self, line: &str) -> bool
Whether line opens a block whose lines sit one step deeper.
Sourcepub fn closes_block(&self, line: &str) -> bool
pub fn closes_block(&self, line: &str) -> bool
Whether line closes the block it sits in, and belongs one step shallower than it.
Sourcepub fn enter(&self, line: &str, at: usize) -> Enter
pub fn enter(&self, line: &str, at: usize) -> Enter
What Enter does at a caret whose line holds line, at bytes of it before the caret.
It breaks the line, and the new line starts at the line’s own indentation — one step
deeper when the text before the caret opens a block. A line that closes a block but
still sits at its block’s depth is first moved back one step.
Sourcepub fn tab_fill(&self, column: usize) -> String
pub fn tab_fill(&self, column: usize) -> String
The spaces Tab inserts at column (counted in characters from 0): to the next stop.
Sourcepub fn indent_lines(&self, lines: &str) -> String
pub fn indent_lines(&self, lines: &str) -> String
lines (whole lines, joined by \n) moved one step deeper; blank lines stay empty.
Sourcepub fn outdent_lines(&self, lines: &str) -> String
pub fn outdent_lines(&self, lines: &str) -> String
lines moved one step shallower, each as far as its own leading spaces allow (a tab
counts as a whole step).
Trait Implementations§
Source§impl Clone for Indentation
impl Clone for Indentation
Source§fn clone(&self) -> Indentation
fn clone(&self) -> Indentation
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for Indentation
impl Debug for Indentation
Source§impl PartialEq for Indentation
impl PartialEq for Indentation
impl Copy for Indentation
impl Eq for Indentation
impl StructuralPartialEq for Indentation
Auto Trait Implementations§
impl Freeze for Indentation
impl RefUnwindSafe for Indentation
impl Send for Indentation
impl Sync for Indentation
impl Unpin for Indentation
impl UnsafeUnpin for Indentation
impl UnwindSafe for Indentation
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> 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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.