Mercurial > crates > nonstick
comparison src/constants.rs @ 172:6727cbe56f4a
Test environment variable setting; minor cleanup.
author | Paul Fisher <paul@pfish.zone> |
---|---|
date | Fri, 25 Jul 2025 21:02:53 -0400 |
parents | e27c5c667a5a |
children | e30775c80b49 |
comparison
equal
deleted
inserted
replaced
171:e27c5c667a5a | 172:6727cbe56f4a |
---|---|
68 | 68 |
69 #[cfg(feature = "link")] | 69 #[cfg(feature = "link")] |
70 impl From<RawFlags> for $name { | 70 impl From<RawFlags> for $name { |
71 #[allow(unused_doc_comments)] | 71 #[allow(unused_doc_comments)] |
72 fn from(value: RawFlags) -> Self { | 72 fn from(value: RawFlags) -> Self { |
73 eprintln!(concat!(stringify!($name), " FROM RAW FLAGS")); | |
74 let value: c_int = value.into(); | 73 let value: c_int = value.into(); |
75 let result = Self::empty(); | 74 let result = Self::empty(); |
76 $( | 75 $( |
77 $(#[$m_ident $($m_arg)*])* | 76 $(#[$m_ident $($m_arg)*])* |
78 let result = result | if value & $value_value == 0 { | 77 let result = result | if value & $value_value == 0 { |
79 eprintln!(concat!("checked against ", stringify!($value_value))); | |
80 Self::empty() | 78 Self::empty() |
81 } else { | 79 } else { |
82 eprintln!(concat!("checked against ", stringify!($value_value), " success")); | |
83 Self::$item_name | 80 Self::$item_name |
84 }; | 81 }; |
85 )* | 82 )* |
86 result | 83 result |
87 } | 84 } |
89 | 86 |
90 #[cfg(feature = "link")] | 87 #[cfg(feature = "link")] |
91 impl From<$name> for RawFlags { | 88 impl From<$name> for RawFlags { |
92 #[allow(unused_doc_comments)] | 89 #[allow(unused_doc_comments)] |
93 fn from(value: $name) -> Self { | 90 fn from(value: $name) -> Self { |
94 eprintln!(concat!("RAW FLAGS FROM ", stringify!($name))); | |
95 let result = 0; | 91 let result = 0; |
96 $( | 92 $( |
97 $(#[$m_ident $($m_arg)*])* | 93 $(#[$m_ident $($m_arg)*])* |
98 let result = result | if value.contains($name::$item_name) { | 94 let result = result | if value.contains($name::$item_name) { |
99 eprintln!(concat!("checked against ", stringify!($item_name), " success")); | |
100 $value_value | 95 $value_value |
101 } else { | 96 } else { |
102 eprintln!(concat!("checked against ", stringify!($item_name))); | |
103 0 | 97 0 |
104 }; | 98 }; |
105 )* | 99 )* |
106 Self(result) | 100 Self(result) |
107 } | 101 } |
428 | 422 |
429 impl<T> From<Result<T>> for ReturnCode { | 423 impl<T> From<Result<T>> for ReturnCode { |
430 fn from(value: Result<T>) -> Self { | 424 fn from(value: Result<T>) -> Self { |
431 match value { | 425 match value { |
432 Ok(_) => ReturnCode::SUCCESS, | 426 Ok(_) => ReturnCode::SUCCESS, |
433 Err(otherwise) => otherwise.into() | 427 Err(otherwise) => otherwise.into(), |
434 } | 428 } |
435 } | 429 } |
436 } | 430 } |
437 | 431 |
438 #[cfg(all(test, feature = "link"))] | 432 #[cfg(all(test, feature = "link"))] |