Add display for Role
This commit adds Display formatting for the Role, for use with the
"human" format.
// limitations under the License.
use std::collections::VecDeque;
+use std::fmt;
use reqwest::blocking::Client;
use serde::{Deserialize, Serialize};
@@ -28,6 +29,20 @@ pub struct Role {
pub permissions: Vec<String>,
}
+impl fmt::Display for Role {
+ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ write!(f, "Id: {}", self.role_id)?;
+ write!(f, "\n Name: {}", self.display_name)?;
+ f.write_str("\n Permissions:")?;
+
+ for perm in self.permissions.iter() {
+ write!(f, "\n {}", perm)?;
+ }
+
+ Ok(())
+ }
+}
+
#[derive(Deserialize)]
pub struct RoleList {
#[serde(rename = "data")]
