1//! SAP Scripting for Rust
2//!
3//! See the examples for how to use this library.
45use windows::Win32::System::Com::*;
67/// The types from this library.
8pub mod types;
910pub use types::*;
1112/// A result of a call.
13pub type Result<T> = ::windows::core::Result<T>;
1415/// An instance of a COM session. This should be kept whilst a connection to SAP is used.
16pub struct SAPComInstance;
1718impl SAPComInstance {
19/// Initialise the COM environment.
20pub fn new() -> Result<Self> {
21log::debug!("CoInitialize'ing.");
22unsafe {
23 CoInitialize(None)?;
24 }
25Ok(SAPComInstance)
26 }
2728/// Create an instance of the SAP wrapper
29pub fn sap_wrapper(&self) -> Result<SAPWrapper> {
30log::debug!("New CSapROTWrapper object generating.");
31 SAPWrapper::new()
32 }
33}
3435impl Drop for SAPComInstance {
36fn drop(&mut self) {
37unsafe {
38 CoUninitialize();
39 }
40 }
41}