tacacs_plus_protocol/accounting/
owned.rs

1use std::string::String;
2use std::string::ToString;
3
4use super::{Reply, Status};
5use crate::owned::FromBorrowedBody;
6use crate::sealed::Sealed;
7
8/// An owned version of a [`Reply`](super::Reply).
9#[derive(Debug, Clone, PartialEq, Eq, Hash)]
10pub struct ReplyOwned {
11    /// The status returned by the server.
12    pub status: Status,
13
14    /// The message to display to the user.
15    pub server_message: String,
16
17    /// The console/administrative message from the server.
18    pub data: String,
19}
20
21impl Sealed for ReplyOwned {}
22
23impl FromBorrowedBody for ReplyOwned {
24    type Borrowed<'b> = Reply<'b>;
25
26    fn from_borrowed(borrowed: &Self::Borrowed<'_>) -> Self {
27        ReplyOwned {
28            status: borrowed.status,
29            server_message: borrowed.server_message.to_string(),
30            data: borrowed.data.to_string(),
31        }
32    }
33}