Mercurial > crates > nonstick
comparison src/module.rs @ 13:cc39d168aeb8
Bring generic-naming in line with rest of lib in `set_item_str`.
| author | Marc Brinkmann <git@marcbrinkmann.de> |
|---|---|
| date | Sun, 26 Feb 2017 12:16:03 +0100 |
| parents | 30831c70e5c0 |
| children | 51b097c12d3c |
comparison
equal
deleted
inserted
replaced
| 12:30831c70e5c0 | 13:cc39d168aeb8 |
|---|---|
| 137 /// | 137 /// |
| 138 /// Note that all items are strings, except `PAM_CONV` and `PAM_FAIL_DELAY`. | 138 /// Note that all items are strings, except `PAM_CONV` and `PAM_FAIL_DELAY`. |
| 139 /// | 139 /// |
| 140 /// See `pam_set_item` in | 140 /// See `pam_set_item` in |
| 141 /// http://www.linux-pam.org/Linux-PAM-html/mwg-expected-by-module-item.html | 141 /// http://www.linux-pam.org/Linux-PAM-html/mwg-expected-by-module-item.html |
| 142 pub fn set_item_str<'a, P: PamItem>(pamh: &'a mut PamHandleT, item: &str) -> PamResult<()> { | 142 pub fn set_item_str<'a, T: PamItem>(pamh: &'a mut PamHandleT, item: &str) -> PamResult<()> { |
| 143 let c_item = CString::new(item).unwrap().as_ptr(); | 143 let c_item = CString::new(item).unwrap().as_ptr(); |
| 144 | 144 |
| 145 let res = unsafe { | 145 let res = unsafe { |
| 146 pam_set_item(pamh, | 146 pam_set_item(pamh, |
| 147 P::item_type(), | 147 T::item_type(), |
| 148 | 148 |
| 149 // unwrapping is okay here, as c_item will not be a NULL | 149 // unwrapping is okay here, as c_item will not be a NULL |
| 150 // pointer | 150 // pointer |
| 151 (c_item as *const PamItemT).as_ref().unwrap()) | 151 (c_item as *const PamItemT).as_ref().unwrap()) |
| 152 }; | 152 }; |
