| 1 | #![cfg_attr(not(feature = "use_std"), no_std)] |
| 2 | |
| 3 | // In the future, don't do this. |
| 4 | mod dec; |
| 5 | mod enc; |
| 6 | pub use crate::dec::*; |
| 7 | pub use crate::enc::*; |
| 8 | |
| 9 | /// Calculates the maximum possible size of an encoded message given the length |
| 10 | /// of the source message. This may be useful for calculating how large the |
| 11 | /// `dest` buffer needs to be in the encoding functions. |
| 12 | pub fn max_encoding_length(source_len: usize) -> usize { |
| 13 | source_len + (source_len / 254) + if source_len % 254 > 0 { 1 } else { 0 } |
| 14 | } |