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.