pub trait DataAcc {
// Required method
fn get_data_conn<C: DataConn + 'static>(
&mut self,
name: impl AsRef<str>,
) -> Result<&mut C>;
}Expand description
This trait provides a mechanism to retrieve a mutable reference to a DataConn object
by name, creating it if necessary.
It is typically implemented as a derived trait with default methods (using
the override_macro crate) on DataHub, allowing application logic to
interact with data services through an abstract interface.
Required Methods§
Sourcefn get_data_conn<C: DataConn + 'static>(
&mut self,
name: impl AsRef<str>,
) -> Result<&mut C>
fn get_data_conn<C: DataConn + 'static>( &mut self, name: impl AsRef<str>, ) -> Result<&mut C>
Retrieves a mutable reference to a DataConn object by name, creating it if necessary.
This is the core method used by DataAcc implementations to obtain connections
to external data services. It first checks if a DataConn with the given name
already exists in the current session. If not, it attempts to find a
corresponding DataSrc and create a new DataConn from it.
§Type Parameters
C: The concrete type ofDataConnexpected.
§Parameters
name: The name of the data source/connection to retrieve.
§Returns
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.