use chrono::{DateTime, Local, Utc};
use core::cmp::{max, min};
use std::collections::{BTreeMap, HashSet};
+use std::ops::Add;
use unicode_width::UnicodeWidthStr;
use super::client::{Client, ClientError};
}
}
- // TODO clippy is right to complain, but I don't think I agree
- // with the proposed resolution. We should rename this method to `push`.
- #[allow(clippy::should_implement_trait)]
- pub fn add(mut self, text: impl ColouredStringCommon) -> Self {
+ pub fn push(&mut self, text: impl ColouredStringCommon) {
self.push_text(text, false);
- self
}
pub fn clear(&mut self) {
}
}
+impl<T: ColouredStringCommon> Add<T> for Paragraph {
+ type Output = Paragraph;
+
+ fn add(mut self, text: T) -> Self {
+ self.push(text);
+ self
+ }
+}
+
#[test]
fn test_para_build() {
assert_eq!(