Struct couchdb::DocumentPath [] [src]

pub struct DocumentPath {
    // some fields omitted
}

Path part of a URI specifying a document.

A document path comprises two or three URI path components specifying a database name and document id—the /db/doc part of the HTTP request to GET http://example.com:5984/db/doc or the /db/_design/design-doc part of http://example.com:5984/db/_design/design-doc.

Document paths are percent-encoded. For example, /foo/bar%2Fqux identifies the database named foo and the document id bar%2Fqux. When a DocumentPath is constructed from name, id, and path types, the percent-encoding is done automatically. When constructing a DocumentPath from a string, the string must be percent-encoded.

Although the DocumentPath 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 DocumentPath 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.

Methods

impl DocumentPath

fn parse<T: AsRef<str>>(path: T) -> Result<Self, Error>

Constructs a DocumentPath from a given string.

The path string must begin with a leading slash and be percent-encoded—e.g., /foo/_design/bar%2Fqux for the database named foo and the design document named bar/qux.

fn into_uri(self, base_uri: Url) -> Url

Converts self into a URI.

Trait Implementations

impl IntoDocumentPath for DocumentPath

fn into_document_path(self) -> Result<DocumentPath, Error>

impl Display for DocumentPath

fn fmt(&self, f: &mut Formatter) -> Result<(), Error>

impl FromStr for DocumentPath

type Err = Error

fn from_str(path: &str) -> Result<Self, Self::Err>

impl<T: Into<DatabasePath>> From<(T, DocumentId)> for DocumentPath

fn from(parts: (T, DocumentId)) -> Self

Derived Implementations

impl PartialOrd for DocumentPath

fn partial_cmp(&self, __arg_0: &DocumentPath) -> Option<Ordering>

fn lt(&self, __arg_0: &DocumentPath) -> bool

fn le(&self, __arg_0: &DocumentPath) -> bool

fn gt(&self, __arg_0: &DocumentPath) -> bool

fn ge(&self, __arg_0: &DocumentPath) -> bool

impl PartialEq for DocumentPath

fn eq(&self, __arg_0: &DocumentPath) -> bool

fn ne(&self, __arg_0: &DocumentPath) -> bool

impl Ord for DocumentPath

fn cmp(&self, __arg_0: &DocumentPath) -> Ordering

impl Hash for DocumentPath

fn hash<__H: Hasher>(&self, __arg_0: &mut __H)

fn hash_slice<H>(data: &[Self], state: &mut H) where H: Hasher

impl Eq for DocumentPath

impl Debug for DocumentPath

fn fmt(&self, __arg_0: &mut Formatter) -> Result

impl Clone for DocumentPath

fn clone(&self) -> DocumentPath

fn clone_from(&mut self, source: &Self)