std-module

std::string — owned text

This module provides the owned text type, text conversion trait and errors for invalid encodings. String is already available through the usual prelude. Expected stdout (not executed): receipt Common mistake: Importing the module and assuming the module itself is a type.

Formal Syntax & Structure

rust syntaxrust
use std::string::String;

Working Example

Example Snippetrust
fn main() {    use std::string::String;    let label = String::from("receipt");    println!("{label}");}
Rust Reference