Skip to main content

RegistrySegment

Struct RegistrySegment 

Source
pub struct RegistrySegment { /* private fields */ }
Expand description

Per-collection registry segment.

Implementations§

Source§

impl RegistrySegment

Source

pub fn new() -> Self

Create an empty segment.

Source

pub fn next_doc_id(&self) -> u64

Return the next document ID that will be assigned (without consuming it).

Source

pub fn get_or_create_field_id( &mut self, collection_id: CollectionId, path: &str, ) -> Result<FieldId, RegistryError>

Return or create a field ID for path.

Source

pub fn get_or_create_doc_internal_id( &mut self, collection_id: CollectionId, external_doc_id: &str, ) -> Result<DocId, RegistryError>

Return or create an internal document ID for external_doc_id.

Source

pub fn field_id(&self, path: &str) -> Option<FieldId>

Resolve field ID by field path.

Source

pub fn field_path(&self, field_id: FieldId) -> Option<&str>

Resolve field path by field ID.

Source

pub fn doc_internal_id(&self, external_doc_id: &str) -> Option<DocId>

Resolve internal document ID by external document ID.

Source

pub fn doc_external_id(&self, doc_id: DocId) -> Option<&str>

Resolve external document ID by internal document ID.

Source

pub fn field_count(&self) -> usize

Number of field IDs in this segment.

Source

pub fn doc_count(&self) -> usize

Number of document IDs in this segment.

Source

pub fn field_mappings(&self) -> Vec<(FieldId, String)>

Return all field mappings as (field_id, field_path) sorted by field ID.

Trait Implementations§

Source§

impl Debug for RegistrySegment

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for RegistrySegment

Source§

fn default() -> RegistrySegment

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.