StatusBuilder::new takes anything that is Display

master
Paul Woolcock 6 years ago
parent e7005b0b6b
commit dc6d2738e1
  1. 6
      src/status_builder.rs

@ -1,3 +1,5 @@
use std::fmt;
/// A builder pattern struct for constructing a status.
#[derive(Debug, Default, Clone, Serialize, PartialEq)]
pub struct StatusBuilder {
@ -41,9 +43,9 @@ impl StatusBuilder {
///
/// let status = StatusBuilder::new("Hello World!");
/// ```
pub fn new<I: Into<String>>(status: I) -> Self {
pub fn new<D: fmt::Display>(status: D) -> Self {
StatusBuilder {
status: status.into(),
status: status.to_string(),
..Self::default()
}
}

Loading…
Cancel
Save