Module couchdb::path [] [src]

The path module provides types for identifying databases, documents, etc.

Summary

Remarks

The CouchDB API uses strings for specifying the locations of resources, and using these strings “in the raw” can be error-prone. The path module provides safer alternatives by way of stronger types.

There are two chief kinds of errors that stronger types help eliminate:

Note, however, that the path module merely makes these types available. It is up to the application programmer to make use of them.

Example

extern crate couchdb;

// Construct view path: '/alpha/_design/bravo/_view/charlie delta':

let view_path = couchdb::DatabaseName::new("alpha")
    .with_design_document_id(couchdb::DesignDocumentName::new("bravo"))
    .with_view_name("charlie delta");

// Paths are percent-encoded and thus well suited for building URLs.

let s = view_path.to_string();
assert_eq!(s, "/alpha/_design/bravo/_view/charlie%20delta");

// Alternatively, paths can be parsed from string.

let v2 = couchdb::ViewPath::parse(&s).unwrap();
assert_eq!(view_path, v2);

Structs

AttachmentName

AttachmentName is a single URL path segment that specifies the name of an attachment.

AttachmentPath

AttachmentPath is the full URL path of an attachment.

DatabaseName

DatabaseName is a single URL path segment that specifies the name of a database.

DatabasePath

DatabasePath is the full URL path of a database.

DesignDocumentId

DesignDocumentId comprises URL path segments that, together, identify a design document.

DesignDocumentName

DesignDocumentName is a single URL path segment that specifies the name of a design document.

DesignDocumentPath

DesignDocumentPath is the full URL path of a design document.

DocumentId

DocumentId comprises one or more URL path segments that, together, identify a document.

DocumentPath

DocumentPath is the full URL path of a document.

LocalDocumentName

LocalDocumentName is a single URL path segment that specifies the name of a local document.

NormalDocumentName

NormalDocumentName is a single URL path segment that specifies the name of a document that is neither a design document nor a local document.

ViewId

ViewId comprises URL path segments that combine a design document name and a view name.

ViewName

ViewName is a single URL path segment that specifies the name of a view.

ViewPath

ViewPath is the full URL path of a view.