pub struct AccountChangeMessage {
    pub output_mode: ConsoleOutputMode,
    pub action: String,
    pub result: String,
    pub status: MessageStatus,
    pub src_user: String,
    pub dest_user: String,
}

Fields§

§output_mode: ConsoleOutputMode§action: String§result: String§status: MessageStatus§src_user: String§dest_user: String

Trait Implementations§

Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more
Deserialize this value from the given Serde deserializer. Read more

This outputs in either JSON or Text depending on the output_mode setting

use std::fmt::format;
use kanidm_proto::messages::*;
let mut msg = AccountChangeMessage::default();
msg.action=String::from("cake_eating");
msg.src_user=String::from("Kani");
msg.dest_user=String::from("Krabby");
msg.result=String::from("It was amazing");
assert_eq!(msg.status, MessageStatus::Success);

let expected_result = "success - cake_eating for Krabby: It was amazing";
assert_eq!(format!("{}", msg), expected_result);

msg.output_mode = ConsoleOutputMode::JSON;
let expected_result = "{\"action\":\"cake_eating\",\"result\":\"It was amazing\",\"status\":\"success\",\"src_user\":\"Kani\",\"dest_user\":\"Krabby\"}";
assert_eq!(format!("{}", msg), expected_result);
Formats the value using the given formatter. Read more
Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Converts the given value to a String. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more