Struct couchdb::ViewResult
[−]
[src]
pub struct ViewResult<K, V> where K: Deserialize, V: Deserialize {
pub total_rows: Option<u64>,
pub offset: Option<u64>,
pub rows: Vec<ViewRow<K, V>>,
// some fields omitted
}
Response resulting from executing a view.
A ViewResult
contains all content in the response from the CouchDB server
as a result of executing a view.
A ViewResult
takes one of two forms. The first form is that the view has
been reduced, in which case the total_rows
and offset
fields are None
and the rows
field contains a single row containing the reduced result.
The second form is that the view has not been reduced, in which case the
total_rows
and offset
fields are Some
and the rows
field contains
zero or more rows containing the unreduced result.
Although the ViewResult
type implements the Ord
and PartialOrd
traits,
it provides no guarantees how that ordering is defined and may change the
definition between any two releases of the couchdb crate. That is, for two
ViewResult
values a
and b
, the expression a < b
may hold true now
but not in a subsequent release. Consequently, applications must not rely
upon any particular ordering definition.
Fields
total_rows | Number of rows in an unreduced view, including rows excluded in the
|
offset | Number of rows in an unreduced view excluded before the first row in the
|
rows | All rows included in the response content for an unreduced view, or, for a reduced view, the one row containing the reduced result. |
Methods
impl<K, V> ViewResult<K, V> where K: Deserialize, V: Deserialize
fn new() -> Self
Constructs an empty view result.
fn new_reduced<T: Into<V>>(value: T) -> Self
Constructs a view result containing only the given value.