Struct chill::ViewFunction
[−]
[src]
pub struct ViewFunction { pub map: String, pub reduce: Option<String>, // some fields omitted }
Container for a map and optional reduce function of a view.
ViewFunction
is a convenience type for applications that work with view
functions in design documents. For more information about view functions and
design documents, please see the CouchDB documentation.
Examples
extern crate chill; let view_function = chill::ViewFunction::new_with_reduce( "function(doc) { emit(doc.key_thing, doc.value_thing); }", "_sum"); assert_eq!("function(doc) { emit(doc.key_thing, doc.value_thing); }", view_function.map); assert_eq!(Some(String::from("_sum")), view_function.reduce);
Fields
map: String
The view's map function.
For more information about map functions, please see the CouchDB documentation.
reduce: Option<String>
The view's reduce function, if available.
For more information about reduce functions, please see the CouchDB documentation.
Methods
impl ViewFunction
[src]
fn new<M: Into<String>>(map: M) -> Self
Constructs a new ViewFunction
that has no reduce function.
fn new_with_reduce<M: Into<String>, R: Into<String>>(map: M, reduce: R) -> Self
Constructs a new ViewFunction
that has a reduce function.
Trait Implementations
impl PartialEq for ViewFunction
[src]
fn eq(&self, __arg_0: &ViewFunction) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &ViewFunction) -> bool
This method tests for !=
.
impl Hash for ViewFunction
[src]
fn hash<__H: Hasher>(&self, __arg_0: &mut __H)
Feeds this value into the state given, updating the hasher as necessary.
fn hash_slice<H>(data: &[Self], state: &mut H) where H: Hasher
1.3.0
Feeds a slice of this type into the state provided.
impl Eq for ViewFunction
[src]
impl Debug for ViewFunction
[src]
impl Clone for ViewFunction
[src]
fn clone(&self) -> ViewFunction
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl Deserialize for ViewFunction
[src]
fn deserialize<D>(deserializer: &mut D) -> Result<Self, D::Error> where D: Deserializer
Deserialize this value given this Deserializer
.
impl Serialize for ViewFunction
[src]
fn serialize<S>(&self, serializer: &mut S) -> Result<(), S::Error> where S: Serializer
Serializes this value into this serializer.