pub struct Tomb<'a> {
pub settings: TombSettings,
/* private fields */
}
Expand description
Tomb helper for given store.
Fields
settings: TombSettings
Tomb settings.
Implementations
sourceimpl<'a> Tomb<'a>
impl<'a> Tomb<'a>
sourcepub fn new(
store: &'a Store,
quiet: bool,
verbose: bool,
force: bool
) -> Tomb<'a>
pub fn new(
store: &'a Store,
quiet: bool,
verbose: bool,
force: bool
) -> Tomb<'a>
Construct new Tomb helper for given store.
sourcepub fn find_tomb_path(&self) -> Result<PathBuf>
pub fn find_tomb_path(&self) -> Result<PathBuf>
Find the tomb path.
Errors if it cannot be found.
sourcepub fn find_tomb_key_path(&self) -> Result<PathBuf>
pub fn find_tomb_key_path(&self) -> Result<PathBuf>
Find the tomb key path.
Errors if it cannot be found.
sourcepub fn open(&self) -> Result<Vec<Err>>
pub fn open(&self) -> Result<Vec<Err>>
Open the tomb.
This will keep the tomb open until it is manually closed. See start_timer()
.
On success this may return a list with soft-fail errors.
sourcepub fn resize(&self, mbs: u32) -> Result<()>
pub fn resize(&self, mbs: u32) -> Result<()>
Resize the tomb.
The Tomb must not be mounted and the size must be larger than the current.
sourcepub fn prepare(&self) -> Result<()>
pub fn prepare(&self) -> Result<()>
Prepare a Tomb store for usage.
- If this store is a Tomb, the tomb is opened.
sourcepub fn start_timer(&self, sec: u32, force: bool) -> Result<()>
pub fn start_timer(&self, sec: u32, force: bool) -> Result<()>
Set up a timer to automatically close password store tomb.
TODO: add support for non-systemd systems
sourcepub fn stop_timer(&self) -> Result<()>
pub fn stop_timer(&self) -> Result<()>
Stop automatic close timer if any is running.
sourcepub fn init(&self, key: &Key, mbs: u32) -> Result<()>
pub fn init(&self, key: &Key, mbs: u32) -> Result<()>
Initialize tomb.
mbs
is the size in megabytes.
The given GPG key is used to encrypt the Tomb key with.
Panics
Panics if given key is not a GPG key.
sourcepub fn is_tomb(&self) -> bool
pub fn is_tomb(&self) -> bool
Check whether the password store is a tomb.
This guesses based on existence of some files. If this returns false you may assume this password store doesn’t use a tomb.
sourcepub fn is_open(&self) -> Result<bool>
pub fn is_open(&self) -> Result<bool>
Check whether the password store is currently opened.
This guesses based on mount information for the password store directory.
sourcepub fn fetch_size_stats(&self) -> Result<TombSize>
pub fn fetch_size_stats(&self) -> Result<TombSize>
Fetch Tomb size statistics.
This attempts to gather password store and tomb size statistics, whether this store is a tomb or not.
This is expensive.
Auto Trait Implementations
impl<'a> RefUnwindSafe for Tomb<'a>
impl<'a> Send for Tomb<'a>
impl<'a> Sync for Tomb<'a>
impl<'a> Unpin for Tomb<'a>
impl<'a> UnwindSafe for Tomb<'a>
Blanket Implementations
impl<Src, Scheme> ApproxFrom<Src, Scheme> for Src where
Scheme: ApproxScheme,
impl<Src, Scheme> ApproxFrom<Src, Scheme> for Src where
Scheme: ApproxScheme,
type Err = NoError
type Err = NoError
The error type produced by a failed conversion.
fn approx_from(src: Src) -> Result<Src, <Src as ApproxFrom<Src, Scheme>>::Err>
fn approx_from(src: Src) -> Result<Src, <Src as ApproxFrom<Src, Scheme>>::Err>
Convert the given value into an approximately equivalent representation.
impl<Dst, Src, Scheme> ApproxInto<Dst, Scheme> for Src where
Dst: ApproxFrom<Src, Scheme>,
Scheme: ApproxScheme,
impl<Dst, Src, Scheme> ApproxInto<Dst, Scheme> for Src where
Dst: ApproxFrom<Src, Scheme>,
Scheme: ApproxScheme,
type Err = <Dst as ApproxFrom<Src, Scheme>>::Err
type Err = <Dst as ApproxFrom<Src, Scheme>>::Err
The error type produced by a failed conversion.
fn approx_into(self) -> Result<Dst, <Src as ApproxInto<Dst, Scheme>>::Err>
fn approx_into(self) -> Result<Dst, <Src as ApproxInto<Dst, Scheme>>::Err>
Convert the subject into an approximately equivalent representation.
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> ConvUtil for T
impl<T> ConvUtil for T
fn approx_as<Dst>(self) -> Result<Dst, Self::Err> where
Self: ApproxInto<Dst, DefaultApprox>,
fn approx_as<Dst>(self) -> Result<Dst, Self::Err> where
Self: ApproxInto<Dst, DefaultApprox>,
Approximate the subject to a given type with the default scheme.
fn approx_as_by<Dst, Scheme>(self) -> Result<Dst, Self::Err> where
Self: ApproxInto<Dst, Scheme>,
Scheme: ApproxScheme,
fn approx_as_by<Dst, Scheme>(self) -> Result<Dst, Self::Err> where
Self: ApproxInto<Dst, Scheme>,
Scheme: ApproxScheme,
Approximate the subject to a given type with a specific scheme.
impl<Src> ValueFrom<Src> for Src
impl<Src> ValueFrom<Src> for Src
type Err = NoError
type Err = NoError
The error type produced by a failed conversion.
fn value_from(src: Src) -> Result<Src, <Src as ValueFrom<Src>>::Err>
fn value_from(src: Src) -> Result<Src, <Src as ValueFrom<Src>>::Err>
Convert the given value into an exactly equivalent representation.
impl<Src, Dst> ValueInto<Dst> for Src where
Dst: ValueFrom<Src>,
impl<Src, Dst> ValueInto<Dst> for Src where
Dst: ValueFrom<Src>,
type Err = <Dst as ValueFrom<Src>>::Err
type Err = <Dst as ValueFrom<Src>>::Err
The error type produced by a failed conversion.
fn value_into(self) -> Result<Dst, <Src as ValueInto<Dst>>::Err>
fn value_into(self) -> Result<Dst, <Src as ValueInto<Dst>>::Err>
Convert the subject into an exactly equivalent representation.