comparison src/constants.rs @ 180:a1bb1d013567

Remove `syn` from the dependency tree by implementing our own num_enum.
author Paul Fisher <paul@pfish.zone>
date Wed, 30 Jul 2025 18:22:16 -0400
parents 6c75fb621b55
children fb8b547b36b7
comparison
equal deleted inserted replaced
179:dba9c1f40883 180:a1bb1d013567
405 405
406 impl Error for ErrorCode {} 406 impl Error for ErrorCode {}
407 407
408 #[cfg(feature = "link")] 408 #[cfg(feature = "link")]
409 impl ErrorCode { 409 impl ErrorCode {
410 /// Returned when an invalid constant is used.
410 #[cfg(feature = "openpam-ext")] 411 #[cfg(feature = "openpam-ext")]
411 const BAD_CONST: ErrorCode = ErrorCode::BadConstant; 412 pub const BAD_CONST: ErrorCode = ErrorCode::BadConstant;
413 /// Returned when an invalid constant is used.
412 #[cfg(not(feature = "openpam-ext"))] 414 #[cfg(not(feature = "openpam-ext"))]
413 const BAD_CONST: ErrorCode = ErrorCode::SystemError; 415 pub const BAD_CONST: ErrorCode = ErrorCode::SystemError;
414 416
415 pub(crate) fn result_from(ret: i32) -> Result<()> { 417 pub(crate) fn result_from(ret: i32) -> Result<()> {
416 match ret { 418 match ret {
417 0 => Ok(()), 419 0 => Ok(()),
418 value => Err(ReturnCode(value).try_into().unwrap_or(Self::BAD_CONST)), 420 value => Err(ReturnCode(value).try_into().unwrap_or(Self::BAD_CONST)),