KeyBoxen 0.1.0

Standalone secret-service daemon for window managers
// Copyright (C) 2022 KeyBoxen Authors
// SPDX-License-Identifier: GPL-3.0-or-later

//! Locking
//!
//! This module deals with locking and unlocking of lockable
//! objects. Within this program, they are collections and items.

pub type Result = std::result::Result<(), ()>;

/// Lockable trait is the locking interface for objects that can be
/// locked in the service. That includes collections and items.
pub trait Lockable {
    // Check whether object is locked
    fn is_locked(&self) -> bool;

    // Lock the object
    fn lock(&mut self) -> Result;

    // Unlock the object
    fn unlock(&mut self) -> Result;
}