Skip to main content

InMemorySchemaBuilder

Struct InMemorySchemaBuilder 

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

Builder for InMemorySchema.

All mutation goes through this builder so the target struct remains invariant-preserving: unique label / rel type / parameter names, deterministic iteration order (spec 0001 §17.14).

Implementations§

Source§

impl InMemorySchemaBuilder

Source

pub fn add_label(self, name: SmolStr, properties: Vec<PropertyDecl>) -> Self

Declare a label. The first insertion wins; subsequent insertions with the same name are recorded and surfaced by InMemorySchemaBuilder::build.

Source

pub fn add_rel_type(self, rel: RelDecl) -> Self

Declare a relationship type. The first insertion wins; subsequent insertions are recorded and surfaced by InMemorySchemaBuilder::build.

Source

pub fn add_parameter(self, param: ParamDecl) -> Self

Declare a query parameter.

Source

pub fn schema_name(self, name: Option<SmolStr>) -> Self

Set the schema name from a [meta] block.

Source

pub fn description(self, desc: Option<String>) -> Self

Set the description from a [meta] block.

Source

pub fn build(self) -> Result<InMemorySchema, BuilderError>

Finalise the builder.

Returns the first duplicate label name encountered (if any), the first duplicate rel type name, or the built schema. Reference validation (rel_type endpoints referring to declared labels) lives in the TOML loader, not the builder — the builder has no view of the original source ordering.

Trait Implementations§

Source§

impl Debug for InMemorySchemaBuilder

Source§

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

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

impl Default for InMemorySchemaBuilder

Source§

fn default() -> InMemorySchemaBuilder

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.