pub struct Metadata<'a> {
pub space_id: SpaceId,
pub index_id: IndexId,
pub name: Cow<'a, str>,
pub type: IndexType,
pub opts: BTreeMap<Cow<'a, str>, Value<'a>>,
pub parts: Vec<Part>,
}
Expand description
Representation of a tuple holding index metadata in system _index
space.
Fields§
§space_id: SpaceId
§index_id: IndexId
§name: Cow<'a, str>
§type: IndexType
§opts: BTreeMap<Cow<'a, str>, Value<'a>>
§parts: Vec<Part>
Implementations§
source§impl Metadata<'_>
impl Metadata<'_>
sourcepub fn to_key_def(&self) -> KeyDef
pub fn to_key_def(&self) -> KeyDef
Construct a KeyDef
instance from index parts.
§Panicking
Will panic if any of the parts have field name instead of field number.
Normally this doesn’t happen, because Metadata
returned from
_index
always has field number, but if you got this metadata from
somewhere else, use Self::try_to_key_def
instead, to check for this
error.
sourcepub fn try_to_key_def(&self) -> Result<KeyDef, FieldMustBeNumber>
pub fn try_to_key_def(&self) -> Result<KeyDef, FieldMustBeNumber>
Construct a KeyDef
instance from index parts. Returns error in case
any of the parts had field name instead of field number.
sourcepub fn to_key_def_for_key(&self) -> KeyDef
pub fn to_key_def_for_key(&self) -> KeyDef
Construct a KeyDef
instance from index parts for comparing keys only.
The difference between this function and Self::to_key_def
is that
the latter is used to compare tuples of a space, while the former is
used to compare only the keys.
Trait Implementations§
source§impl<'de, 'a> Deserialize<'de> for Metadata<'a>
impl<'de, 'a> Deserialize<'de> for Metadata<'a>
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl<'a> PartialEq for Metadata<'a>
impl<'a> PartialEq for Metadata<'a>
impl<'a> Eq for Metadata<'a>
impl<'a> StructuralPartialEq for Metadata<'a>
Auto Trait Implementations§
impl<'a> Freeze for Metadata<'a>
impl<'a> RefUnwindSafe for Metadata<'a>
impl<'a> Send for Metadata<'a>
impl<'a> Sync for Metadata<'a>
impl<'a> Unpin for Metadata<'a>
impl<'a> UnwindSafe for Metadata<'a>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more