This commit is contained in:
Roman Proskuryakov 2021-03-28 09:48:34 +03:00
parent 3de878b09e
commit f7cb3e575f
5 changed files with 19 additions and 27 deletions

View File

@ -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>

View File

@ -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;

View File

@ -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 = ();

View File

@ -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,
};