Struct tantivy::schema::Facet
[−]
[src]
pub struct Facet(_);
A Facet represent a point in a given hierarchy.
They are typically represented similarly to a filepath.
For instance, an e-commerce website could
have a Facet
for /electronics/tv_and_video/led_tv
.
A document can be associated to any number of facets.
The hierarchy implicitely imply that a document
belonging to a facet also belongs to the ancestor of
its facet. In the example above, /electronics/tv_and_video/
and /electronics
.
Methods
impl Facet
[src]
pub fn root() -> Facet
[src]
Returns a new instance of the "root facet"
Equivalent to /
.
pub fn is_root(&self) -> bool
[src]
Returns true iff the facet is the root facet /
.
pub fn encoded_bytes(&self) -> &[u8]
[src]
Returns a binary representation of the facet.
In this representation, 0u8
is used as a separator
and the string parts of the facet are unescaped.
(The first /
is not encoded at all).
This representation has the benefit of making it possible to express "being a child of a given facet" as a range over the term ordinals.
pub fn from_text<T: ?Sized>(path: &T) -> Facet where
T: AsRef<str>,
[src]
T: AsRef<str>,
Parse a text representation of a facet.
It is conceptually, if one of the steps of this path
contains a /
or a \
, it should be escaped
using an anti-slash /
.
pub fn from_path<Path>(path: Path) -> Facet where
Path: IntoIterator,
Path::Item: ToString,
[src]
Path: IntoIterator,
Path::Item: ToString,
Returns a Facet
from an iterator over the different
steps of the facet path.
The steps are expected to be unescaped.
pub fn is_prefix_of(&self, other: &Facet) -> bool
[src]
Returns true
iff other is a subfacet of self
.
Trait Implementations
impl Clone for Facet
[src]
fn clone(&self) -> Facet
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Eq for Facet
[src]
impl Hash for Facet
[src]
fn hash<__H: Hasher>(&self, __arg_0: &mut __H)
[src]
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl PartialEq for Facet
[src]
fn eq(&self, __arg_0: &Facet) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Facet) -> bool
[src]
This method tests for !=
.
impl Ord for Facet
[src]
fn cmp(&self, __arg_0: &Facet) -> Ordering
[src]
This method returns an Ordering
between self
and other
. Read more
fn max(self, other: Self) -> Self
1.21.0[src]
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
1.21.0[src]
Compares and returns the minimum of two values. Read more
impl PartialOrd for Facet
[src]
fn partial_cmp(&self, __arg_0: &Facet) -> Option<Ordering>
[src]
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, __arg_0: &Facet) -> bool
[src]
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, __arg_0: &Facet) -> bool
[src]
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, __arg_0: &Facet) -> bool
[src]
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, __arg_0: &Facet) -> bool
[src]
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl Borrow<[u8]> for Facet
[src]
impl<'a, T: ?Sized + AsRef<str>> From<&'a T> for Facet
[src]
impl Display for Facet
[src]
fn fmt(&self, f: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more
impl Serialize for Facet
[src]
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> where
S: Serializer,
[src]
S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl<'de> Deserialize<'de> for Facet
[src]
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where
D: Deserializer<'de>,
[src]
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Debug for Facet
[src]
fn fmt(&self, f: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more