Struct tarantool::space::Builder

source ·
pub struct Builder<'a> { /* private fields */ }

Implementations§

source§

impl<'a> Builder<'a>

source

pub fn new(name: &'a str) -> Self

source

pub fn if_not_exists(self, if_not_exists: bool) -> Self

source

pub fn engine(self, engine: SpaceEngineType) -> Self

source

pub fn id(self, id: SpaceId) -> Self

source

pub fn field_count(self, field_count: u32) -> Self

source

pub fn user(self, user: String) -> Self

source

pub fn space_type(self, space_type: SpaceType) -> Self

source

pub fn is_local(self, is_local: bool) -> Self

👎Deprecated: use Builder::space_type instead
source

pub fn temporary(self, temporary: bool) -> Self

👎Deprecated: use Builder::space_type instead
source

pub fn is_sync(self, is_sync: bool) -> Self

👎Deprecated: use Builder::space_type instead
source

pub fn field(self, field: impl Into<Field>) -> Self

Add a field to the space’s format.

Use this method to set each field individually or use format to set fields in bulk. The difference is purely syntactical.

source

pub fn format(self, format: impl IntoIterator<Item = impl Into<Field>>) -> Self

Add fields to the space’s format.

Use this method to set fields in bulk or use field to set each field individually. The difference is purely syntactical.

use tarantool::space::{Space, FieldType as FT, IsNullable};

let space = Space::builder("user_names")
    .format([
        ("id", FT::Unsigned),
        ("name", FT::String),
    ])
    .field(("nickname", FT::String, IsNullable::Nullable))
    .create();
source

pub fn create(self) -> Result<Space>

Create a space with the current configuration.

NOTE: This function will initiate a transaction if there’s isn’t an active one, and if there is the active transaction may be aborted in case of an error. This shouldn’t be a problem if you always consider this function returning an error to be worthy of a transcation roll back, which you should.

source

pub fn into_parts(self) -> (&'a str, SpaceCreateOptions)

Destructure the builder struct into a tuple of name and space options.

Auto Trait Implementations§

§

impl<'a> RefUnwindSafe for Builder<'a>

§

impl<'a> Send for Builder<'a>

§

impl<'a> Sync for Builder<'a>

§

impl<'a> Unpin for Builder<'a>

§

impl<'a> UnwindSafe for Builder<'a>

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> Same for T

§

type Output = T

Should always be Self
source§

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

§

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>,

§

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.