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

Method text_len

crates/ruff_python_formatter/src/string/docstring.rs:1734–1744  ·  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

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

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