pub(crate) struct Trivia(String);Expand description
Whitespace and comments, kept as source text.
Tuple Fields§
§0: StringImplementations§
Source§impl Trivia
impl Trivia
pub(in json) const fn new( text: String, ) -> Self
pub(in json) fn as_str( &self, ) -> &str
Sourcepub(super) fn indent(&self) -> &str
pub(super) fn indent(&self) -> &str
The blanks that start the last line of the text, or nothing when the text has no line break.
pub(super) fn is_blank(&self) -> bool
pub(super) fn has_newline(&self) -> bool
Sourcepub(super) fn reindent_from(&mut self, from: &str, to: &str)
pub(super) fn reindent_from(&mut self, from: &str, to: &str)
Replace the indent from at the start of every line with to.
Sourcepub(super) fn reindent_unit(&mut self, unit: &Indent)
pub(super) fn reindent_unit(&mut self, unit: &Indent)
Convert the indent at the start of every line from the canonical
two spaces per level to unit per level.
Sourcepub(super) fn write_comment(
out: &mut String,
comment: Option<&Comment>,
indent: &str,
dialect: Dialect,
)
pub(super) fn write_comment( out: &mut String, comment: Option<&Comment>, indent: &str, dialect: Dialect, )
The comment as // lines after indent. JSON has no comments.
Sourcepub(super) fn root(comment: Option<&Comment>, dialect: Dialect) -> Self
pub(super) fn root(comment: Option<&Comment>, dialect: Dialect) -> Self
The comment lines of the document root, and a blank line after them.
Trait Implementations§
impl Eq for Trivia
impl StructuralPartialEq for Trivia
Auto Trait Implementations§
impl Freeze for Trivia
impl RefUnwindSafe for Trivia
impl Send for Trivia
impl Sync for Trivia
impl Unpin for Trivia
impl UnsafeUnpin for Trivia
impl UnwindSafe for Trivia
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,
§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
Compare self to
key and return true if they are equal.