OpenOptions

Struct OpenOptions 

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

Options and flags which can be used to configure how a Galaxy is opened.

This builder exposes the ability to configure how a Galaxy is opened and what permissions on the opened galaxy, or more exactly, the graphs it manages.

Generally speaking, when using Options, you’ll first call OpenOptions::new, then chain calls to methods to set each option, then call OpenOptions::open to open a galaxy. This will give a crate::Result with a Galaxy inside that you can further operate on.

§Examples

use tugraph::{db::OpenOptions, Error};
let galaxy = OpenOptions::new()
    .create(true)
    .open("/tmp/rust_tugraph/doc/OpenOptions", "admin", "73@TuGraph")?;

Implementations§

Source§

impl OpenOptions

Source

pub fn new() -> Self

Creates a initial new set of options with dir where the database was created or to be created, the username and password used to open if exists.

All other options not listed in parameters are default to false.

§Errors

TODO(eadrenking@outlook.com)

§Examples
use tugraph::{db::OpenOptions, Error};
let galaxy = OpenOptions::new()
    .create(true)
    .open("/tmp/rust_tugraph/doc/open_new", "admin", "73@TuGraph")?;
Source

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

Whether the read-write transaction commited into database should be durable.

§Errors

TODO(eadrenking@outlook.com)

§Examples
use tugraph::{db::OpenOptions, Error};
let galaxy = OpenOptions::new()
    .create(true)
    .durable(true)
    .open("/tmp/rust_tugraph/doc/open_durable", "admin", "73@TuGraph")?;
Source

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

Whether the read-write transaction commited into database should be durable.

§Errors

TODO(eadrenking@outlook.com)

§Examples
use tugraph::{db::OpenOptions, Error};
let galaxy = OpenOptions::new()
    .create(true)
    .durable(true)
    .open("/tmp/rust_tugraph/doc/open_create", "admin", "73@TuGraph")?;
Source

pub fn open<P: AsRef<Path>>( self, dir: P, username: &str, password: &str, ) -> Result<Galaxy>

Open a Galaxy with options specified by self.

§Errors

TODO(eadrenking@outlook.com)

§Examples
use tugraph::{db::OpenOptions, Error};
let galaxy = OpenOptions::new()
    .create(true)
    .durable(true)
    .open("/tmp/rust_tugraph/doc/open", "admin", "73@TuGraph")?;

Trait Implementations§

Source§

impl Default for OpenOptions

Source§

fn default() -> OpenOptions

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.