sasl: Make this crate no_std

We mostly had to import from alloc some structs that are part of the std
prelude, such as Vec and String.
This commit is contained in:
Emmanuel Gil Peyrot 2024-09-25 21:55:02 +02:00
commit dc842c44d1
14 changed files with 57 additions and 19 deletions

View file

@ -1,5 +1,7 @@
use std::collections::BTreeMap;
use std::string::FromUtf8Error;
use alloc::borrow::ToOwned;
use alloc::collections::BTreeMap;
use alloc::string::{FromUtf8Error, String};
use alloc::vec::Vec;
#[cfg(feature = "scram")]
pub mod scram;

View file

@ -1,3 +1,7 @@
use alloc::string::{String, ToString};
use alloc::vec;
use alloc::vec::Vec;
use core::fmt;
use getrandom::{getrandom, Error as RngError};
use hmac::{digest::InvalidLength, Hmac, Mac};
use pbkdf2::pbkdf2;
@ -25,8 +29,8 @@ pub enum DeriveError {
IncompatibleIterationCount(u32, u32),
}
impl std::fmt::Display for DeriveError {
fn fmt(&self, fmt: &mut std::fmt::Formatter) -> std::fmt::Result {
impl fmt::Display for DeriveError {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
match self {
DeriveError::IncompatibleHashingMethod(one, two) => {
write!(fmt, "incompatible hashing method, {} is not {}", one, two)
@ -40,7 +44,7 @@ impl std::fmt::Display for DeriveError {
}
}
impl std::error::Error for DeriveError {}
impl core::error::Error for DeriveError {}
impl From<hmac::digest::InvalidLength> for DeriveError {
fn from(_err: hmac::digest::InvalidLength) -> DeriveError {