pub struct HashConsDedupSerializer {
ser: RefCell<TypeMap<SerializeTableMapper>>,
de: RefCell<TypeMap<DeserializeTableMapper>>,
}Expand description
HashCons supports serializing each value to a unique id in order to serialize
highly-shared values without explosion.
Note that the deduplication scheme is highly order-dependent: we serialize the real value
the first time it comes up, and use ids only subsequent times. This relies on the fact that
derive(Serialize, Deserialize) traverse the value in the same order.
Fields§
§ser: RefCell<TypeMap<SerializeTableMapper>>§de: RefCell<TypeMap<DeserializeTableMapper>>Trait Implementations§
Source§impl Default for HashConsDedupSerializer
impl Default for HashConsDedupSerializer
Source§fn default() -> HashConsDedupSerializer
fn default() -> HashConsDedupSerializer
Returns the “default value” for a type. Read more
Source§impl HashConsSerializerState for HashConsDedupSerializer
impl HashConsSerializerState for HashConsDedupSerializer
Source§fn record_serialized<T: Mappable>(&self, id: HashConsId) -> Option<bool>
fn record_serialized<T: Mappable>(&self, id: HashConsId) -> Option<bool>
Record that this type is being serialized. Return
None if we’re not deduplicating
values, otherwise return whether this item was newly recorded.Source§fn record_deserialized<T: Mappable>(&self, id: HashConsId, val: HashConsed<T>)
fn record_deserialized<T: Mappable>(&self, id: HashConsId, val: HashConsed<T>)
Record that we deserialized this type.
Source§fn get_deserialized_val<T: Mappable>(
&self,
id: HashConsId,
) -> Option<HashConsed<T>>
fn get_deserialized_val<T: Mappable>( &self, id: HashConsId, ) -> Option<HashConsed<T>>
Find the previously-deserialized type with that id.
Auto Trait Implementations§
impl !Freeze for HashConsDedupSerializer
impl !RefUnwindSafe for HashConsDedupSerializer
impl Send for HashConsDedupSerializer
impl !Sync for HashConsDedupSerializer
impl Unpin for HashConsDedupSerializer
impl !UnwindSafe for HashConsDedupSerializer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<I, T> ExtractContext<I, ()> for T
impl<I, T> ExtractContext<I, ()> for T
§fn extract_context(self, _original_input: I)
fn extract_context(self, _original_input: I)
Given the context attached to a nom error, and given the original
input to the nom parser, extract more the useful context information. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<I> RecreateContext<I> for I
impl<I> RecreateContext<I> for I
§fn recreate_context(_original_input: I, tail: I) -> I
fn recreate_context(_original_input: I, tail: I) -> I
Given the original input, as well as the context reported by nom,
recreate a context in the original string where the error occurred. Read more