Skip to content

Commit 6ec4fcf

Browse files
committed
Implment fmt::show for RGBA
1 parent 95bf7d0 commit 6ec4fcf

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

color.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
44

55
use std::ascii::StrAsciiExt;
6+
use std::fmt;
67

78
use ast::*;
89

@@ -17,6 +18,12 @@ pub struct RGBA {
1718
pub alpha: f32,
1819
}
1920

21+
impl fmt::Show for RGBA {
22+
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
23+
write!(f, "(r={} g={} b={} a={})", self.red, self.green, self.blue, self.alpha)
24+
}
25+
}
26+
2027
#[deriving(Clone, PartialEq)]
2128
pub enum Color {
2229
CurrentColor,

0 commit comments

Comments
 (0)