Mercurial > crates > nonstick
annotate src/items.rs @ 12:30831c70e5c0
Remove PhantomData usage.
PhantomData is used through the library to substitute associated
constants (to types). However, calling
`PamItem::item_type(PhantomData<T>)` can easily be substituted by
calling `T::item_type()`, getting rid of the need for PhantomData.
| author | Marc Brinkmann <git@marcbrinkmann.de> |
|---|---|
| date | Sun, 26 Feb 2017 12:12:36 +0100 |
| parents | 827faa554528 |
| children |
| rev | line source |
|---|---|
| 11 | 1 use constants::{PamItemType, PAM_SERVICE, PAM_USER, PAM_USER_PROMPT, PAM_TTY, PAM_RUSER, PAM_RHOST, |
| 2 PAM_AUTHTOK, PAM_OLDAUTHTOK}; | |
| 3 use module::PamItem; | |
| 4 pub use conv::PamConv; | |
| 5 | |
| 6 | |
| 7 pub struct PamService {} | |
| 8 | |
| 9 impl PamItem for PamService { | |
|
12
30831c70e5c0
Remove PhantomData usage.
Marc Brinkmann <git@marcbrinkmann.de>
parents:
11
diff
changeset
|
10 fn item_type() -> PamItemType { |
| 11 | 11 PAM_SERVICE |
| 12 } | |
| 13 } | |
| 14 | |
| 15 pub struct PamUser {} | |
| 16 | |
| 17 impl PamItem for PamUser { | |
|
12
30831c70e5c0
Remove PhantomData usage.
Marc Brinkmann <git@marcbrinkmann.de>
parents:
11
diff
changeset
|
18 fn item_type() -> PamItemType { |
| 11 | 19 PAM_USER |
| 20 } | |
| 21 } | |
| 22 | |
| 23 pub struct PamUserPrompt {} | |
| 24 | |
| 25 impl PamItem for PamUserPrompt { | |
|
12
30831c70e5c0
Remove PhantomData usage.
Marc Brinkmann <git@marcbrinkmann.de>
parents:
11
diff
changeset
|
26 fn item_type() -> PamItemType { |
| 11 | 27 PAM_USER_PROMPT |
| 28 } | |
| 29 } | |
| 30 | |
| 31 pub struct PamTty {} | |
| 32 | |
| 33 impl PamItem for PamTty { | |
|
12
30831c70e5c0
Remove PhantomData usage.
Marc Brinkmann <git@marcbrinkmann.de>
parents:
11
diff
changeset
|
34 fn item_type() -> PamItemType { |
| 11 | 35 PAM_TTY |
| 36 } | |
| 37 } | |
| 38 | |
| 39 pub struct PamRUser {} | |
| 40 | |
| 41 impl PamItem for PamRUser { | |
|
12
30831c70e5c0
Remove PhantomData usage.
Marc Brinkmann <git@marcbrinkmann.de>
parents:
11
diff
changeset
|
42 fn item_type() -> PamItemType { |
| 11 | 43 PAM_RUSER |
| 44 } | |
| 45 } | |
| 46 | |
| 47 pub struct PamRHost {} | |
| 48 | |
| 49 impl PamItem for PamRHost { | |
|
12
30831c70e5c0
Remove PhantomData usage.
Marc Brinkmann <git@marcbrinkmann.de>
parents:
11
diff
changeset
|
50 fn item_type() -> PamItemType { |
| 11 | 51 PAM_RHOST |
| 52 } | |
| 53 } | |
| 54 | |
| 55 pub struct PamAuthTok {} | |
| 56 | |
| 57 impl PamItem for PamAuthTok { | |
|
12
30831c70e5c0
Remove PhantomData usage.
Marc Brinkmann <git@marcbrinkmann.de>
parents:
11
diff
changeset
|
58 fn item_type() -> PamItemType { |
| 11 | 59 PAM_AUTHTOK |
| 60 } | |
| 61 } | |
| 62 | |
| 63 pub struct PamOldAuthTok {} | |
| 64 | |
| 65 impl PamItem for PamOldAuthTok { | |
|
12
30831c70e5c0
Remove PhantomData usage.
Marc Brinkmann <git@marcbrinkmann.de>
parents:
11
diff
changeset
|
66 fn item_type() -> PamItemType { |
| 11 | 67 PAM_OLDAUTHTOK |
| 68 } | |
| 69 } |
