before_first_colon

Function before_first_colon 

Source
pub(crate) fn before_first_colon(s: &str) -> &str
Expand description

Strips suffix beginning at first ‘:’; returns subslice before colon.

§Performance

  • Single forward traversal O(n); avoids UTF-8 decoding (colon is ASCII).
  • Simple explicit loop similar in cost to find(':').