mirror of
https://github.com/rust-embedded/heapless.git
synced 2025-10-02 23:04:40 +00:00
Fix fmt
This commit is contained in:
parent
3de878b09e
commit
f7cb3e575f
20
src/de.rs
20
src/de.rs
@ -1,10 +1,10 @@
|
||||
use crate::{
|
||||
sealed::binary_heap::Kind as BinaryHeapKind, BinaryHeap, IndexMap, IndexSet, LinearMap, String,
|
||||
Vec,
|
||||
};
|
||||
use core::{fmt, marker::PhantomData};
|
||||
use hash32::{BuildHasherDefault, Hash, Hasher};
|
||||
use serde::de::{self, Deserialize, Deserializer, Error, MapAccess, SeqAccess};
|
||||
use crate::{
|
||||
sealed::binary_heap::Kind as BinaryHeapKind,
|
||||
BinaryHeap, IndexMap, IndexSet, LinearMap, String, Vec,
|
||||
};
|
||||
|
||||
// Sequential containers
|
||||
|
||||
@ -218,24 +218,18 @@ where
|
||||
|
||||
// String containers
|
||||
|
||||
impl<'de, const N:usize> Deserialize<'de> for String<N>
|
||||
{
|
||||
impl<'de, const N: usize> Deserialize<'de> for String<N> {
|
||||
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
|
||||
where
|
||||
D: Deserializer<'de>,
|
||||
{
|
||||
struct ValueVisitor<'de, const N: usize>(PhantomData<&'de ()>);
|
||||
|
||||
impl<'de, const N:usize > de::Visitor<'de> for ValueVisitor<'de, N>
|
||||
{
|
||||
impl<'de, const N: usize> de::Visitor<'de> for ValueVisitor<'de, N> {
|
||||
type Value = String<N>;
|
||||
|
||||
fn expecting(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
write!(
|
||||
formatter,
|
||||
"a string no more than {} bytes long",
|
||||
N as u64
|
||||
)
|
||||
write!(formatter, "a string no more than {} bytes long", N as u64)
|
||||
}
|
||||
|
||||
fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
|
||||
|
@ -126,14 +126,12 @@ macro_rules! probe_loop {
|
||||
}
|
||||
}
|
||||
|
||||
struct CoreMap<K, V, const N: usize>
|
||||
{
|
||||
struct CoreMap<K, V, const N: usize> {
|
||||
entries: Vec<Bucket<K, V>, N>,
|
||||
indices: [Option<Pos>; N],
|
||||
}
|
||||
|
||||
impl<K, V, const N: usize> CoreMap<K, V, N>
|
||||
{
|
||||
impl<K, V, const N: usize> CoreMap<K, V, N> {
|
||||
const fn new() -> Self {
|
||||
const INIT: Option<Pos> = None;
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
use ufmt_write::uWrite;
|
||||
use crate::{string::String, vec::Vec};
|
||||
use ufmt_write::uWrite;
|
||||
|
||||
impl<const N: usize> uWrite for String<N> {
|
||||
type Error = ();
|
||||
|
@ -1,7 +1,7 @@
|
||||
//! Collections of `Send`-able things are `Send`
|
||||
|
||||
use heapless::{
|
||||
spsc::{Consumer, Producer, Queue, MultiCore},
|
||||
spsc::{Consumer, MultiCore, Producer, Queue},
|
||||
HistoryBuffer, Vec,
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user