mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-01-10 21:44:34 +01:00
Make sure we use an FxHashBuilder on the Value
This commit is contained in:
parent
a751972c57
commit
aeb6b74725
4
Cargo.lock
generated
4
Cargo.lock
generated
@ -708,9 +708,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bumparaw-collections"
|
name = "bumparaw-collections"
|
||||||
version = "0.1.2"
|
version = "0.1.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "833a74d1cb25094593307c17044e4140828b553d1d653bc3ec9928aa88a6d88a"
|
checksum = "4ce682bdc86c2e25ef5cd95881d9d6a1902214eddf74cf9ffea88fe1464377e8"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"allocator-api2",
|
"allocator-api2",
|
||||||
"bitpacking",
|
"bitpacking",
|
||||||
|
@ -9,6 +9,7 @@ use liquid::model::{
|
|||||||
Value as LiquidValue,
|
Value as LiquidValue,
|
||||||
};
|
};
|
||||||
use liquid::{ObjectView, ValueView};
|
use liquid::{ObjectView, ValueView};
|
||||||
|
use rustc_hash::FxBuildHasher;
|
||||||
use serde_json::value::RawValue;
|
use serde_json::value::RawValue;
|
||||||
|
|
||||||
use crate::update::del_add::{DelAdd, KvReaderDelAdd};
|
use crate::update::del_add::{DelAdd, KvReaderDelAdd};
|
||||||
@ -195,7 +196,7 @@ impl<'doc, D: DocumentTrait<'doc> + Debug> ObjectView for ParseableDocument<'doc
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<'doc, D: DocumentTrait<'doc> + Debug> ValueView for ParseableDocument<'doc, D> {
|
impl<'doc, D: DocumentTrait<'doc> + Debug> ValueView for ParseableDocument<'doc, D> {
|
||||||
fn as_debug(&self) -> &dyn fmt::Debug {
|
fn as_debug(&self) -> &dyn Debug {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
fn render(&self) -> liquid::model::DisplayCow<'_> {
|
fn render(&self) -> liquid::model::DisplayCow<'_> {
|
||||||
@ -243,14 +244,13 @@ impl<'doc, D: DocumentTrait<'doc> + Debug> ValueView for ParseableDocument<'doc,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
|
||||||
struct ParseableValue<'doc> {
|
struct ParseableValue<'doc> {
|
||||||
value: Value<'doc>,
|
value: Value<'doc, FxBuildHasher>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'doc> ParseableValue<'doc> {
|
impl<'doc> ParseableValue<'doc> {
|
||||||
pub fn new(value: &'doc RawValue, doc_alloc: &'doc Bump) -> Self {
|
pub fn new(value: &'doc RawValue, doc_alloc: &'doc Bump) -> Self {
|
||||||
let value = Value::from_raw_value(value, doc_alloc).unwrap();
|
let value = Value::from_raw_value_and_hasher(value, FxBuildHasher, doc_alloc).unwrap();
|
||||||
Self { value }
|
Self { value }
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -260,19 +260,19 @@ impl<'doc> ParseableValue<'doc> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// transparent newtype for implementing ValueView
|
// transparent newtype for implementing ValueView
|
||||||
#[repr(transparent)]
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
struct ParseableMap<'doc>(RawMap<'doc>);
|
#[repr(transparent)]
|
||||||
|
struct ParseableMap<'doc>(RawMap<'doc, FxBuildHasher>);
|
||||||
|
|
||||||
// transparent newtype for implementing ValueView
|
// transparent newtype for implementing ValueView
|
||||||
#[repr(transparent)]
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
#[repr(transparent)]
|
||||||
struct ParseableArray<'doc>(RawVec<'doc>);
|
struct ParseableArray<'doc>(RawVec<'doc>);
|
||||||
|
|
||||||
impl<'doc> ParseableMap<'doc> {
|
impl<'doc> ParseableMap<'doc> {
|
||||||
pub fn as_parseable<'a>(map: &'a RawMap<'doc>) -> &'a ParseableMap<'doc> {
|
pub fn as_parseable<'a>(map: &'a RawMap<'doc, FxBuildHasher>) -> &'a ParseableMap<'doc> {
|
||||||
// SAFETY: repr(transparent)
|
// SAFETY: repr(transparent)
|
||||||
unsafe { &*(map as *const RawMap as *const Self) }
|
unsafe { &*(map as *const RawMap<FxBuildHasher> as *const Self) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -612,6 +612,12 @@ impl<'doc> ValueView for ParseableValue<'doc> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Debug for ParseableValue<'_> {
|
||||||
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
|
f.debug_struct("ParseableValue").field("value", &self.value).finish()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
struct ArraySource<'s, 'doc> {
|
struct ArraySource<'s, 'doc> {
|
||||||
s: &'s RawVec<'doc>,
|
s: &'s RawVec<'doc>,
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user