Skip to main content

FlussoMap

Trait FlussoMap 

Source
pub trait FlussoMap<K> { }
Expand description

A Rust type usable as the document type of a map field of value kind K: a dynamic-key object whose values are all of kind K.

The canonical map type — HashMap<String, V> where V is a K value — is pre-implemented via a blanket impl, so HashMap<String, String> is a valid text/keyword map and HashMap<String, i64> a valid long map with no extra code. A whole-map newtype wrapper (struct Translations(HashMap<…>)) opts in with #[derive(FlussoMap)]. FlussoDocument emits a deferred bound on this trait for a map field, so the document only compiles when its type genuinely fits the declared value kind.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<K, V: FlussoValue<K>> FlussoMap<K> for HashMap<String, V>

Implementors§