Structs

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.
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).
Block that is formatted as an item.
An iterator over the lines of a string, paired with the char kind at the end of the line.
A regex matching reference doc links.
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

Enum indicating if the code block contains rust based on attributes
Distinguish between functional part of code and comments
Distinguish between functional part of code and comments, describing opening and closing of comments for ease when chunking code from tagged characters

Constants

Traits

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 and next_str into a single String. span may contain comments between two strings. If there are such comments, then that will be recovered. If allow_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.
Returns true if text contains any comment.
has_url 🔒
Returns true if the given string MAY include URLs or alike.
Returns true if the last line of the passed string finishes with a block-comment.
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 from span, if it removed any, return previous text (if it fits in the width/offset, else return None), else return new
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.
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.