use ansi_term::Style; #[derive(Clone)] pub struct Segment { name: Option, style: Style, value: String, prefix: OptionalSegment, suffix: OptionalSegment, } impl Segment { pub fn new(name: T) -> Segment where T: Into, T: Copy, { let default_prefix = Some(Box::new(Segment { name: Some(format!("{} {}", name.into(), "prefix")), style: Style::default(), value: String::from("via "), prefix: None, suffix: None, })); let default_suffix = Some(Box::new(Segment { name: Some(format!("{} {}", name.into(), "suffix")), style: Style::default(), value: String::from(" "), prefix: None, suffix: None, })); Segment { name: Some(name.into()), style: Style::default(), value: String::from(""), prefix: default_prefix, suffix: default_suffix, } } pub fn set_style<'a, T>(&'a mut self, style: T) -> &'a mut Segment where T: Into