Struct elastic::types::prelude::Keyword [] [src]

pub struct Keyword<M> where
    M: KeywordMapping
{ /* fields omitted */ }

An Elasticsearch keyword with a mapping.

Where the mapping isn't custom, you can use the standard library String instead.

Examples

Defining a keyword with a mapping:

use elastic_types::string::keyword::mapping::DefaultKeywordMapping;
use elastic_types::string::keyword::Keyword;

let string = Keyword::<DefaultKeywordMapping>::new("my string value");

Methods

impl<M> Keyword<M> where
    M: KeywordMapping
[src]

Creates a new Keyword with the given mapping.

Examples

Create a new Keyword from a String:

use elastic_types::string::keyword::mapping::DefaultKeywordMapping;
use elastic_types::string::keyword::Keyword;
    
let string = Keyword::<DefaultKeywordMapping>::new("my string");

Change the mapping of this string.

Methods from Deref<Target = String>

Converts a String into a byte vector.

This consumes the String, so we do not need to copy its contents.

Examples

Basic usage:

let s = String::from("hello");
let bytes = s.into_bytes();

assert_eq!(&[104, 101, 108, 108, 111][..], &bytes[..]);

Extracts a string slice containing the entire string.

Returns this String's capacity, in bytes.

Examples

Basic usage:

let s = String::with_capacity(10);

assert!(s.capacity() >= 10);

Returns a byte slice of this String's contents.

The inverse of this method is from_utf8.

Examples

Basic usage:

let s = String::from("hello");

assert_eq!(&[104, 101, 108, 108, 111], s.as_bytes());

Returns the length of this String, in bytes.

Examples

Basic usage:

let a = String::from("foo");

assert_eq!(a.len(), 3);

Returns true if this String has a length of zero.

Returns false otherwise.

Examples

Basic usage:

let mut v = String::new();
assert!(v.is_empty());

v.push('a');
assert!(!v.is_empty());

Converts this String into a Box<str>.

This will drop any excess capacity.

Examples

Basic usage:

let s = String::from("hello");

let b = s.into_boxed_str();

Trait Implementations

impl<M> Default for Keyword<M> where
    M: Default + KeywordMapping
[src]

impl<M> AsRef<str> for Keyword<M> where
    M: KeywordMapping
[src]

impl<M> AsRef<String> for Keyword<M> where
    M: KeywordMapping
[src]

impl<'a, M> PartialEq<&'a str> for Keyword<M> where
    M: KeywordMapping
[src]

impl<M> PartialEq<Keyword<M>> for Keyword<M> where
    M: PartialEq<M> + KeywordMapping
[src]

impl<M> PartialEq<String> for Keyword<M> where
    M: KeywordMapping
[src]

impl<M> Serialize for Keyword<M> where
    M: KeywordMapping
[src]

Serialize this value into the given Serde serializer. Read more

impl<'de, M> Deserialize<'de> for Keyword<M> where
    M: KeywordMapping
[src]

impl<M> From<String> for Keyword<M> where
    M: KeywordMapping
[src]

Performs the conversion.

impl<M> Deref for Keyword<M> where
    M: KeywordMapping
[src]

The resulting type after dereferencing

The method called to dereference a value

impl<M> KeywordFieldType<M> for Keyword<M> where
    M: KeywordMapping
[src]

impl<M> Debug for Keyword<M> where
    M: Debug + KeywordMapping
[src]

Formats the value using the given formatter.

impl<M> Clone for Keyword<M> where
    M: Clone + KeywordMapping
[src]