parsers: add umbrella enum for SASL elements
This is useful if, for example during stream negotiation, you want to parse SASL elements and nothing else. It is also useful if you want to write down an enum of all XMPP-related stream-level elements you accept and don't want to loose your fingers typing all the SASL options.
This commit is contained in:
parent
fc68a57757
commit
3c78310272
1 changed files with 29 additions and 0 deletions
|
|
@ -163,6 +163,35 @@ pub struct Failure {
|
|||
pub texts: BTreeMap<Lang, String>,
|
||||
}
|
||||
|
||||
/// Enum which allows parsing/serialising any SASL element.
|
||||
#[derive(FromXml, AsXml, Debug, Clone)]
|
||||
#[xml()]
|
||||
pub enum Nonza {
|
||||
/// Abortion of SASL transaction
|
||||
#[xml(transparent)]
|
||||
Abort(Abort),
|
||||
|
||||
/// Failure of SASL transaction
|
||||
#[xml(transparent)]
|
||||
Failure(Failure),
|
||||
|
||||
/// Success of SASL transaction
|
||||
#[xml(transparent)]
|
||||
Success(Success),
|
||||
|
||||
/// Initiation of SASL transaction
|
||||
#[xml(transparent)]
|
||||
Auth(Auth),
|
||||
|
||||
/// Challenge sent by the server to the client
|
||||
#[xml(transparent)]
|
||||
Challenge(Challenge),
|
||||
|
||||
/// Response sent by the client to the server
|
||||
#[xml(transparent)]
|
||||
Response(Response),
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
|
|
|||
Loading…
Reference in a new issue