Skip to main content

print

Function print 

Source
pub fn print(buf: &DocBuf, root: DocId, profile: &Profile) -> String
Expand description

Prints the layout document buf from its node root, at the width of profile, and returns the text.

The result is the text of print_full with the same arguments; use print_full to know where marked parts were printed.

§Panics

root must have been created by buf, and not before a call to DocBuf::clear: an id beyond the arena’s nodes panics with an index error. An id from another arena that is within range refers to the node at that index instead, a caller error the engine cannot detect.

In a debug build, also if the child of a flush_right node prints a line break (see that constructor’s requirements).