This should work:
fn main() {
let c = "hello";
println!("{}", c);
}
The string "{}"
is a template where {}
will be replaced by the next argument passed to println!
.
More Related Contents:
- Traits and Rust
- Why do I need to import a trait to use the methods it defines for a type?
- Should trait bounds be duplicated in struct and impl?
- How do I collect into an array?
- Can I do type introspection with trait objects and then downcast it?
- Cannot borrow as mutable more than once at a time in one code – but can in another very similar
- How do you access enum values in Rust?
- Situations where Cell or RefCell is the best choice
- error [E0716]: temporary value dropped while borrowed (rust)
- Can I get a trait object of a multi-trait instance without using a generic type?
- Trait implementation for both a trait object and for direct implementors of the trait
- Why does my variable not live long enough?
- How to iterate over and filter an array?
- If BufReader takes ownership of a stream, how can I read and write lines on it?
- How to fix lifetime error when function returns a serde Deserialize type?
- Is there another option to share an Arc in multiple closures besides cloning it before each closure?
- Why are recursive struct types illegal in Rust?
- Understanding Traits and Object Safety
- How do I pass a closure through raw pointers as an argument to a C function?
- Is there a way to use existing structs as enum variants?
- How can I create enums with constant values in Rust?
- How to embed resources in Rust executable?
- Sized is not implemented for the type Fn
- Extend lifetime of variable
- Can’t implement a trait I don’t own for all types that implement a trait I do own
- How to quiet a warning for a single statement in Rust?
- Is there an elegant solution to modifying a structure while iterating?
- How do I cope with lazy iterators?
- Can a struct containing a raw pointer implement Send and be FFI safe?
- Lazy sequence generation in Rust