1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
use crate::alloc::boxed::Box;
use crate::mechanisms::anonymous::{client, server};
use crate::mechname::Mechname;
use crate::property::Property;
use crate::registry::{Matches, Mechanism, Named};
use crate::session::Side;
#[non_exhaustive]
pub struct AnonymousToken;
impl Property<'_> for AnonymousToken {
type Value = str;
}
#[cfg(feature = "registry_static")]
use crate::registry::{distributed_slice, MECHANISMS};
#[cfg_attr(feature = "registry_static", distributed_slice(MECHANISMS))]
pub static ANONYMOUS: Mechanism = Mechanism {
mechanism: Mechname::const_new(b"ANONYMOUS"),
priority: 100,
client: Some(|| Ok(Box::new(client::Anonymous))),
server: Some(|_sasl| Ok(Box::new(server::Anonymous))),
first: Side::Client,
select: |_| Some(Matches::<Select>::name()),
offer: |_| true,
};
struct Select;
impl Named for Select {
fn mech() -> &'static Mechanism {
&ANONYMOUS
}
}