Module rustfmt_nightly::comment
source ยท Structsยง
- CharClasses ๐
- CommentCodeSlices ๐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.
- CommentReducer ๐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).
- CommentRewrite ๐
- ItemizedBlock ๐Block that is formatted as an item.
- LineClasses ๐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ยง
- CharClassesStatus ๐
- CodeBlockAttribute ๐Enum indicating if the code block contains rust based on attributes
- CodeCharKind ๐Distinguish between functional part of code and comments
- CommentStyle ๐
- FullCodeCharKind ๐Distinguish between functional part of code and comments, describing opening and closing of comments for ease when chunking code from tagged characters
Constantsยง
Traitsยง
- FindUncommented ๐
- RichChar ๐
Functionsยง
- Returns
trueif the two strings of code have the same payload of comments. The payload of comments is everything in the string except: - Combine
prev_strandnext_strinto a singleString.spanmay contain comments between two strings. If there are such comments, then that will be recovered. Ifallow_extendis 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 ๐Returns
trueif text contains any comment. - custom_opener ๐
- filter_normal_code ๐
- find_comment_end ๐
- has_url ๐Returns
trueif 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
newdidnโ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.