Function contains

Source
pub fn contains<T: Send + Sync + 'static>() -> Result<bool, String>
Expand description

Checks if a value of type T is registered in the global registry.

§Returns

  • Ok(true) if the type is registered
  • Ok(false) if the type is not found
  • Err(String) if failed to acquire the registry lock

§Examples

use singleton_registry::{register, contains};

// Check for unregistered type
assert!(!contains::<i32>().expect("Failed to check registry"));

// Register and check
register(42i32);
assert!(contains::<i32>().expect("Failed to check registry"));