Skip to main content

GuardBuilder

Struct GuardBuilder 

Source
pub struct GuardBuilder { /* private fields */ }
Available on crate feature guard only.
Expand description

Options for Guard.

Implementations§

Source§

impl GuardBuilder

Source

pub fn lock_dir(self, dir: impl Into<PathBuf>) -> Self

The directory for the lock and pid files. The default depends only on the user (see guard); a database should pass its data directory. Created owner-only (0700) on Unix when missing; on Windows it inherits its parent’s permissions, so choose a parent other users cannot write to (not C:\ProgramData itself).

Source

pub fn lock(self, on: bool) -> Self

Whether to take the single-instance lock (default true). Pass false when a supervisor holds it, as tower does across hand-off restarts.

Source

pub fn allow_network_lock(self, on: bool) -> Self

Accept a lock directory on a network filesystem (nfs, cifs, WSL’s 9p), whose locks may not hold across machines (default false).

Source

pub fn umask(self, mask: u32) -> Self

The umask to set (default 0o027). Unix only; ignored on Windows.

Source

pub fn keep_umask(self) -> Self

Leave the umask as it is.

Source

pub fn open_files_target(self, n: u64) -> Self

The soft open-file limit to raise to (default 65 536), capped at the hard limit and, on macOS, at kern.maxfilesperproc.

Source

pub fn open_files_minimum(self, n: u64) -> Self

The hard open-file limit below which the guard refuses to start (default 1 024).

Source

pub fn build(self) -> Result<Guard>

Starts the guard. See guard for the errors.

Trait Implementations§

Source§

impl Clone for GuardBuilder

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for GuardBuilder

Source§

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

Formats the value using the given formatter. 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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.