Mercurial > crates > nonstick
comparison src/constants.rs @ 70:9f8381a1c09c
Implement low-level conversation primitives.
This change does two primary things:
1. Introduces new Conversation traits, to be implemented both
by the library and by PAM client applications.
2. Builds the memory-management infrastructure for passing messages
through the conversation.
...and it adds tests for both of the above, including ASAN tests.
author | Paul Fisher <paul@pfish.zone> |
---|---|
date | Tue, 03 Jun 2025 01:21:59 -0400 |
parents | bbe84835d6db |
children | 58f9d2a4df38 |
comparison
equal
deleted
inserted
replaced
69:8f3ae0c7ab92 | 70:9f8381a1c09c |
---|---|
188 fn from(value: c_int) -> Self { | 188 fn from(value: c_int) -> Self { |
189 Self(value, PhantomData) | 189 Self(value, PhantomData) |
190 } | 190 } |
191 } | 191 } |
192 | 192 |
193 /// Returned when text that should not have any `\0` bytes in it does. | |
194 /// Analogous to [`std::ffi::NulError`], but the data it was created from | |
195 /// is borrowed. | |
196 #[derive(Debug, thiserror::Error)] | |
197 #[error("null byte within input at byte {0}")] | |
198 pub struct NulError(pub usize); | |
199 | |
200 /// Returned when trying to fit too much data into a binary message. | |
201 #[derive(Debug, thiserror::Error)] | |
202 #[error("cannot create a message of {actual} bytes; maximum is {max}")] | |
203 pub struct TooBigError { | |
204 pub actual: usize, | |
205 pub max: usize, | |
206 } | |
207 | |
193 #[cfg(test)] | 208 #[cfg(test)] |
194 mod tests { | 209 mod tests { |
195 use super::*; | 210 use super::*; |
196 | 211 |
197 #[test] | 212 #[test] |