Struct SzEnvironmentCore

Source
pub struct SzEnvironmentCore {
    is_destroyed: Arc<AtomicBool>,
    is_initialized: Arc<AtomicBool>,
    module_name: String,
    ini_params: String,
    verbose_logging: bool,
}
Expand description

Core implementation of the SzEnvironment trait

This struct manages the lifecycle of the Senzing environment and serves as a factory for obtaining instances of other SDK components.

Fields§

§is_destroyed: Arc<AtomicBool>§is_initialized: Arc<AtomicBool>§module_name: String§ini_params: String§verbose_logging: bool

Implementations§

Source§

impl SzEnvironmentCore

Source

pub fn new( module_name: &str, ini_params: &str, verbose_logging: bool, ) -> SzResult<Self>

Creates a new SzEnvironment instance

§Arguments
  • module_name - Name of the module for logging purposes
  • ini_params - JSON string containing initialization parameters
  • verbose_logging - Whether to enable verbose logging
Source

pub fn new_default() -> SzResult<Self>

Creates a new SzEnvironment instance with default parameters

Source

pub fn get_instance( module_name: &str, ini_params: &str, verbose_logging: bool, ) -> SzResult<Arc<Self>>

Gets or creates the global singleton SzEnvironmentCore instance

This method ensures that only one SzEnvironmentCore instance exists per process, which is required by the Senzing SDK.

§Arguments
  • module_name - Name of the module for logging purposes
  • ini_params - JSON string containing initialization parameters
  • verbose_logging - Whether to enable verbose logging
Source

pub fn get_existing_instance() -> SzResult<Arc<Self>>

Gets the existing global singleton SzEnvironmentCore instance

This method returns the existing singleton instance without creating a new one. It will return an error if no instance has been created yet.

§Returns

Returns the existing singleton instance or an error if none exists.

Source

pub fn try_get_instance() -> Option<Arc<Self>>

Gets the global singleton instance if it exists

Returns None if no instance has been created yet.

Source

pub fn destroy_global_instance() -> SzResult<()>

Destroys the global singleton instance

This allows a new instance to be created with different parameters.

Source

pub fn get_ini_params(&self) -> &str

Get the initialization parameters used by this environment

Source

pub fn get_verbose_logging(&self) -> bool

Get the verbose logging setting used by this environment

Source

fn ensure_initialized(&self) -> SzResult<()>

Ensures Sz_init has been called - should be called before any engine operations

This method is thread-safe and will only call Sz_init once.

Trait Implementations§

Source§

impl Drop for SzEnvironmentCore

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl SzEnvironment for SzEnvironmentCore

Source§

fn destroy(&mut self) -> SzResult<()>

Destroys the environment and releases all resources
Source§

fn is_destroyed(&self) -> bool

Checks if the environment has been destroyed
Source§

fn reinitialize(&self, config_id: ConfigId) -> SzResult<()>

Reinitializes the environment with a specific configuration Note: Sz_reinit is thread-safe, so this doesn’t require a mutable reference
Source§

fn get_active_config_id(&self) -> SzResult<ConfigId>

Gets the currently active configuration ID
Source§

fn get_product(&self) -> SzResult<Box<dyn SzProduct>>

Gets the product interface instance
Source§

fn get_engine(&self) -> SzResult<Box<dyn SzEngine>>

Gets the engine interface instance
Source§

fn get_config_manager(&self) -> SzResult<Box<dyn SzConfigManager>>

Gets the configuration manager interface instance
Source§

fn get_diagnostic(&self) -> SzResult<Box<dyn SzDiagnostic>>

Gets the diagnostic interface instance

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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.