chore: rename key parameter to id while checking for existence
This commit is contained in:
@@ -1,22 +1,22 @@
|
||||
use crate::*;
|
||||
|
||||
impl Catalog {
|
||||
/// Checks if the catalog contains an entity with the specified key.
|
||||
/// Checks if the catalog contains an entity with the specified ID.
|
||||
///
|
||||
/// # Arguments
|
||||
///
|
||||
/// * `k` - The key to check for.
|
||||
/// * `id` - The ID to check for.
|
||||
///
|
||||
/// # Returns
|
||||
///
|
||||
/// `Ok(true)` if an entity with the specified key exists in the catalog,
|
||||
/// `Ok(true)` if an entity with the specified ID exists in the catalog,
|
||||
/// `Ok(false)` otherwise.
|
||||
///
|
||||
/// # Errors
|
||||
///
|
||||
/// Returns `Err(FailedTo::LockCatalog)` if the catalog's internal mutex
|
||||
/// could not be locked.
|
||||
pub fn contains_key(&self, k: &str) -> Result<bool, FailedTo> {
|
||||
self.with_items(|items| Ok(items.contains_key(k)))
|
||||
pub fn contains_key(&self, id: &str) -> Result<bool, FailedTo> {
|
||||
self.with_items(|items| Ok(items.contains_key(id)))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user