MCPcopy Create free account
hub / github.com/astral-sh/ruff / text_len

Method text_len

crates/ruff_python_formatter/src/string/docstring.rs:1731–1741  ·  view source on GitHub ↗

Returns the length of the indentation in bytes. # Panics If the indentation is longer than 4GB.

(self)

Source from the content-addressed store, hash-verified

1729 /// # Panics
1730 /// If the indentation is longer than 4GB.
1731 fn text_len(self) -> TextSize {
1732 let len = match self {
1733 Self::Spaces(count) => count,
1734 Self::Tabs(count) => count,
1735 Self::TabSpaces { tabs, spaces } => tabs + spaces,
1736 Self::SpacesTabs { spaces, tabs } => spaces + tabs,
1737 Self::Mixed { len, .. } => return len,
1738 };
1739
1740 TextSize::try_from(len).unwrap()
1741 }
1742
1743 /// Trims the indent of `rhs` by `self`.
1744 ///

Callers 9

format_rangeFunction · 0.45
formatFunction · 0.45
add_iterMethod · 0.45
print_oneMethod · 0.45
from_strMethod · 0.45
fmtMethod · 0.45
max_empty_linesFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected