Skip to content
masterclass Buddy

Rust · Class

String

String is Rust’s owned, growable UTF-8 string type. It stores text in a heap buffer and supports adding, converting, and reading string data.

Last updated

Since
1.0.0

Syntax

pub struct String { /* private fields */ }

In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.

Subscribe
  • str
  • OsString
  • ToString
  • from_utf8
  • from_utf8_lossy
  • push
  • push_str
  • with_capacity

Source: String in std::string - Rust. Checked 2026-11-03.