comparison src/constants.rs @ 77:351bdc13005e

Update the libpam module to work with the new structure.
author Paul Fisher <paul@pfish.zone>
date Sun, 08 Jun 2025 01:03:46 -0400
parents 58f9d2a4df38
children 5aa1a010f1e8
comparison
equal deleted inserted replaced
76:e58d24849e82 77:351bdc13005e
172 val as Self 172 val as Self
173 } 173 }
174 } 174 }
175 175
176 /// Error returned when attempting to coerce an invalid C integer into an enum. 176 /// Error returned when attempting to coerce an invalid C integer into an enum.
177 #[derive(thiserror::Error)] 177 #[derive(Debug, PartialEq, thiserror::Error)]
178 #[error("{0} is not a valid {type}", type = any::type_name::<T>())] 178 #[error("{0} is not a valid {type}", type = any::type_name::<T>())]
179 #[derive(Debug, PartialEq)]
180 pub struct InvalidEnum<T>(c_int, PhantomData<T>); 179 pub struct InvalidEnum<T>(c_int, PhantomData<T>);
181 180
182 impl<T> From<InvalidEnum<T>> for c_int { 181 impl<T> From<InvalidEnum<T>> for c_int {
183 fn from(value: InvalidEnum<T>) -> Self { 182 fn from(value: InvalidEnum<T>) -> Self {
184 value.0 183 value.0