MappingObject

Trait MappingObject 

Source
pub trait MappingObject: MappingType {
    // Provided method
    fn document_mapping() -> MappingDocument { ... }
}
Expand description

Trait for types that can be used as Elasticsearch document mappings.

This trait is automatically implemented by the #[derive(Document)] macro. It provides the document_mapping() method to generate the complete mapping definition.

§Example

use elastic_mapping::{Document, MappingObject};

#[derive(Document)]
struct Product {
    name: String,
    price: f64,
}

let mapping = Product::document_mapping();

Provided Methods§

Source

fn document_mapping() -> MappingDocument

Generates the complete Elasticsearch mapping definition for this type.

Returns a MappingDocument containing the mapping JSON with the "mappings" root object.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§