pub struct Entry(/* private fields */);Expand description
An AST node representing a Entry.
Implementations§
Source§impl Entry
impl Entry
Sourcepub fn text_range(&self) -> TextRange
pub fn text_range(&self) -> TextRange
Returns the text range of this entry in the source text.
Sourcepub fn key_range(&self) -> Option<TextRange>
pub fn key_range(&self) -> Option<TextRange>
Returns the text range of the key (field name) in this entry.
Sourcepub fn colon_range(&self) -> Option<TextRange>
pub fn colon_range(&self) -> Option<TextRange>
Returns the text range of the colon separator in this entry.
Sourcepub fn value_range(&self) -> Option<TextRange>
pub fn value_range(&self) -> Option<TextRange>
Returns the text range of the value portion (excluding the key and colon) in this entry. This includes all VALUE tokens and any continuation lines.
Sourcepub fn value_line_ranges(&self) -> Vec<TextRange>
pub fn value_line_ranges(&self) -> Vec<TextRange>
Returns the text ranges of all individual value lines in this entry. Multi-line values will return multiple ranges.
Sourcepub fn wrap_and_sort(
&self,
indentation: Indentation,
immediate_empty_line: bool,
max_line_length_one_liner: Option<usize>,
format_value: Option<&dyn Fn(&str, &str) -> String>,
) -> Entry
pub fn wrap_and_sort( &self, indentation: Indentation, immediate_empty_line: bool, max_line_length_one_liner: Option<usize>, format_value: Option<&dyn Fn(&str, &str) -> String>, ) -> Entry
Reformat this entry
§Arguments
indentation- The indentation to useimmediate_empty_line- Whether multi-line values should always start with an empty linemax_line_length_one_liner- If set, then this is the max length of the value if it is crammed into a “one-liner” valueformat_value- If set, then this function will format the value according to the given function
§Returns
The reformatted entry
Trait Implementations§
impl Eq for Entry
impl StructuralPartialEq for Entry
Auto Trait Implementations§
impl Freeze for Entry
impl !RefUnwindSafe for Entry
impl !Send for Entry
impl !Sync for Entry
impl Unpin for Entry
impl !UnwindSafe for Entry
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