Skip to content

Commit

Permalink
example for padding any format
Browse files Browse the repository at this point in the history
  • Loading branch information
RalfJung committed Oct 17, 2019
1 parent 4e6efe4 commit c0b7e76
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/liballoc/fmt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,12 @@
//!
//! Note that alignment may not be implemented by some types. In particular, it
//! is not generally implemented for the `Debug` trait. A good way to ensure
//! padding is applied is to format your input, then use this resulting string
//! to pad your output.
//! padding is applied is to format your input, then pad this resulting string
//! to obtain your output:
//!
//! ```
//! println!("Hello {:^15}!", format!("{:?}", Some("hi"))); // => "Hello Some("hi") !"
//! ```
//!
//! ## Sign/`#`/`0`
//!
Expand Down

0 comments on commit c0b7e76

Please sign in to comment.