Skip to content

Commit

Permalink
Stabilize fmt_flags_align
Browse files Browse the repository at this point in the history
  • Loading branch information
tmccombs committed Apr 30, 2018
1 parent f900bcf commit 40aed49
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
2 changes: 2 additions & 0 deletions src/liballoc/fmt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,8 @@
pub use core::fmt::rt;
#[stable(feature = "rust1", since = "1.0.0")]
pub use core::fmt::{Formatter, Result, Write};
#[stable(feature = "fmt_flags_align", since = "1.27.0")]
pub use core::fmt::Alignment;
#[stable(feature = "rust1", since = "1.0.0")]
pub use core::fmt::{Binary, Octal};
#[stable(feature = "rust1", since = "1.0.0")]
Expand Down
1 change: 1 addition & 0 deletions src/liballoc/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@
#![feature(custom_attribute)]
#![feature(dropck_eyepatch)]
#![feature(exact_size_is_empty)]
#![feature(fmt_flags_align)]
#![feature(fmt_internals)]
#![feature(fn_must_use)]
#![feature(from_ref)]
Expand Down
19 changes: 8 additions & 11 deletions src/libcore/fmt/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,14 @@ mod builders;

#[unstable(feature = "fmt_flags_align", issue = "27726")]
/// Possible alignments returned by `Formatter::align`
#[derive(Debug)]
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub enum Alignment {
/// Indication that contents should be left-aligned.
Left,
/// Indication that contents should be right-aligned.
Right,
/// Indication that contents should be center-aligned.
Center,
/// No alignment was requested.
Unknown,
Center
}

#[stable(feature = "debug_builders", since = "1.2.0")]
Expand Down Expand Up @@ -1385,14 +1383,13 @@ impl<'a> Formatter<'a> {
pub fn fill(&self) -> char { self.fill }

/// Flag indicating what form of alignment was requested
#[unstable(feature = "fmt_flags_align", reason = "method was just created",
issue = "27726")]
pub fn align(&self) -> Alignment {
#[stable(feature = "fmt_flags_align", since = "1.27.0")]
pub fn align(&self) -> Option<Alignment> {
match self.align {
rt::v1::Alignment::Left => Alignment::Left,
rt::v1::Alignment::Right => Alignment::Right,
rt::v1::Alignment::Center => Alignment::Center,
rt::v1::Alignment::Unknown => Alignment::Unknown,
rt::v1::Alignment::Left => Some(Alignment::Left),
rt::v1::Alignment::Right => Some(Alignment::Right),
rt::v1::Alignment::Center => Some(Alignment::Center),
rt::v1::Alignment::Unknown => None,
}
}

Expand Down

0 comments on commit 40aed49

Please sign in to comment.