Module rustfmt_nightly::comment
source ยท Structsยง
- Char
Classes ๐ - Comment
Code ๐Slices Iterator over an alternating sequence of functional and commented parts of a string. The first item is always a, possibly zero length, subslice of functional text. Line style comments contain their ending newlines. - Comment
Reducer ๐Iterator over the โpayloadโ characters of a comment. It skips whitespace, comment start/end marks, and โ*โ at the beginning of lines. The comment must be one comment, ie not more than one start mark (no multiple line comments, for example). - Comment
Rewrite ๐ - Itemized
Block ๐Block that is formatted as an item. - Line
Classes ๐An iterator over the lines of a string, paired with the char kind at the end of the line. - Iterator over functional and commented parts of a string. Any part of a string is either functional code, either one block comment, either one line comment. Whitespace between comments is functional code. Line comments contain their ending newlines.
Enumsยง
- Char
Classes ๐Status - Code
Block ๐Attribute Enum indicating if the code block contains rust based on attributes - Code
Char ๐Kind Distinguish between functional part of code and comments - Comment
Style ๐ - Full
Code ๐Char Kind Distinguish between functional part of code and comments, describing opening and closing of comments for ease when chunking code from tagged characters
Constantsยง
Traitsยง
- Find
Uncommented ๐ - Rich
Char ๐
Functionsยง
- Returns
true
if the two strings of code have the same payload of comments. The payload of comments is everything in the string except: - Combine
prev_str
andnext_str
into a singleString
.span
may contain comments between two strings. If there are such comments, then that will be recovered. Ifallow_extend
is true and there is no comment between the two strings, then they will be put on a single line as long as doing so does not exceed max width. - comment_
style ๐ - contains_
comment ๐Returnstrue
if text contains any comment. - custom_
opener ๐ - filter_
normal_ ๐code - find_
comment_ ๐end - has_url ๐Returns
true
if the given string MAY include URLs or alike. - identify_
comment ๐ - is_
custom_ ๐comment - Returns true if the last line of the passed string finishes with a block-comment.
- is_
raw_ ๐string_ suffix - is_
table_ ๐item Returns true if the given string may be part of a Markdown table. - Determine the line_start when formatting markdown block quotes. The original line_start likely contains indentation (whitespaces), which weโd like to replace with โ> โ characters.
- Trims comment characters and possibly a single space from the left of a string. Does not trim all whitespace. If a single space is trimmed from the left of the string, this function returns true.
- Trims whitespace and aligns to indent, but otherwise does not change comments.
- Checks is
new
didnโt miss any comment fromspan
, if it removed any, return previous text (if it fits in the width/offset, else returnNone
), else returnnew
- Recover the missing comments in the specified span, if available. The layout of the comments will be preserved as long as it does not break the code and its total width does not exceed the max width.
- rewrite_
comment ๐ - rewrite_
doc_ ๐comment - Given the span, rewrite the missing comment inside it if available. Note that the given span must only include comments (or leading/trailing whitespaces).
- Trim trailing whitespaces unless they consist of two or more whitespaces.