Struct CapeLibraryDetails

Source
pub struct CapeLibraryDetails {
    pub(crate) interface: *mut ICapeLibraryDetails,
}
Expand description

CapeLibraryDetails provides details about a registered COBIA type library

§Examples

use cobia;
use cobia::prelude::*;
use cobia::cape_open_1_2;
cobia::cape_open_initialize().unwrap();
let library_enumerator = cobia::CapeTypeLibraries::new().unwrap();
let library_details = library_enumerator.get_library_by_library_id(&cape_open_1_2::LIBRARY_ID).unwrap();
assert_eq!(library_details.get_name().unwrap(),"CAPEOPEN_1_2");
cobia::cape_open_cleanup();

Fields§

§interface: *mut ICapeLibraryDetails

Implementations§

Source§

impl CapeLibraryDetails

Source

pub(crate) fn from_interface_pointer( interface: *mut ICapeLibraryDetails, ) -> Self

Create a new CapeLibraryDetails from an interface pointer

This member is not typically called. Instead, the CapeLibraryDetails is created by the API functions that return it.

§Safety

The interface pointer must be valid and must point to an object that implements the ICapeLibraryDetails interface.

§Panics

This function panics if the interface pointer is null.

Source

pub(crate) fn attach(interface: *mut ICapeLibraryDetails) -> Self

Create a new CapeLibraryDetails from an interface pointer without adding a reference

This member is not typically called. Instead, the CapeLibraryDetails is created by the API functions that return it.

§Safety

The interface pointer must be valid and must point to an object that implements the ICapeLibraryDetails interface.

§Panics

This function panics if the interface pointer is null.

Source

pub fn get_name(&self) -> Result<String, COBIAError>

Get the name of the library

The name of the library as it is appears in the registry.

§Errors

Returns an error if the name cannot be retrieved.

§Examples
use cobia;
use cobia::prelude::*;
use cobia::cape_open_1_2;
cobia::cape_open_initialize().unwrap();
let library_enumerator = cobia::CapeTypeLibraries::new().unwrap();
let library_details = library_enumerator.get_library_by_library_id(&cape_open_1_2::LIBRARY_ID).unwrap();
assert_eq!(library_details.get_name().unwrap(),"CAPEOPEN_1_2");
cobia::cape_open_cleanup();
Source

pub fn get_uuid(&self) -> Result<CapeUUID, COBIAError>

Get the id of the library

Get the id of the library as CapeUUID.

§Errors

Returns an error if the id cannot be retrieved.

§Examples
use cobia;
use cobia::prelude::*;
use cobia::cape_open_1_2;
cobia::cape_open_initialize().unwrap();
let library_enumerator = cobia::CapeTypeLibraries::new().unwrap();
let library_details = library_enumerator.get_library_by_library_id(&cape_open_1_2::LIBRARY_ID).unwrap();
assert_eq!(&library_details.get_uuid().unwrap(),&cape_open_1_2::LIBRARY_ID);
cobia::cape_open_cleanup();
Source

pub fn get_library_version(&self) -> Result<String, COBIAError>

Get the version of the library

Get the version of the library as string.

§Errors

Returns an error if the version cannot be retrieved.

§Examples
use cobia;
use cobia::prelude::*;
use cobia::cape_open_1_2;
cobia::cape_open_initialize().unwrap();
let library_enumerator = cobia::CapeTypeLibraries::new().unwrap();
let library_details = library_enumerator.get_library_by_library_id(&cape_open_1_2::LIBRARY_ID).unwrap();
assert!(library_details.get_library_version().unwrap().starts_with("1.2")); //there are 3 numbers to a CAPE-OPEN type library version; we get the newest installed 1.2
cobia::cape_open_cleanup();
Source

pub fn get_library_path(&self) -> Result<PathBuf, COBIAError>

Get the file name of the CIDL file

Get the full path to the CAPE-OPEN Interface Definition Language (CIDL) file that contains the type definitions of all types in the library.

§Errors

Returns an error if the version cannot be retrieved.

§Examples
use cobia;
use cobia::prelude::*;
use cobia::cape_open_1_2;
use std::path::Path;
cobia::cape_open_initialize().unwrap();
let library_enumerator = cobia::CapeTypeLibraries::new().unwrap();
let library_details = library_enumerator.get_library_by_library_id(&cape_open_1_2::LIBRARY_ID).unwrap();
assert!(library_details.get_library_path().unwrap().exists()); 
cobia::cape_open_cleanup();
Source

pub fn get_proxy_interface_provider_location( &self, service: CapePMCServiceType, ) -> Option<PathBuf>

Get proxy provider file name

Get the full path of the dynamic libary that contains the proxy interface provider for a given service, if a proxy provider for that service is indeed registered for the requested type library.

§Arguments
  • service - The service for which the proxy provider is requested.
§Examples
use cobia;
use cobia::prelude::*;
use cobia::cape_open_1_2;
use std::path::Path;
cobia::cape_open_initialize().unwrap();
let library_enumerator = cobia::CapeTypeLibraries::new().unwrap();
let library_details = library_enumerator.get_library_by_library_id(&cape_open_1_2::LIBRARY_ID).unwrap();
match library_details.get_proxy_interface_provider_location(cobia::CapePMCServiceType::Inproc64) {
   Some(path) => {
       assert!(path.exists());
   },
   None => {
       // no proxy provider for this service
   }
}
cobia::cape_open_cleanup();

Trait Implementations§

Source§

impl CapeSmartPointer for CapeLibraryDetails

Source§

type Interface = ICapeLibraryDetails

Source§

fn as_interface_pointer(&self) -> *mut Self::Interface

Get the interface pointer Read more
Source§

fn as_cape_interface_pointer(&self) -> *mut ICapeInterface

Get the ICapeInterface Read more
Source§

fn get_interface_id() -> &'static CapeUUID

Get the interface ID Read more
Source§

fn from_object<T: CapeSmartPointer>( smart_pointer: &T, ) -> Result<Self, COBIAError>

Get an interface wrapper instance from another object Read more
Source§

fn from_interface_pointer(interface: *mut Self::Interface) -> Self

Get an interface wrapper instance from an interface pointer of the wrapped type Read more
Source§

fn attach(interface: *mut Self::Interface) -> Self

Get an interface wrapper instance from an interface pointer of the wrapped type, without adding a reference Read more
Source§

fn detach(self) -> *mut Self::Interface

Return an interface pointer and release ownership, without decreasing a reference Read more
Source§

fn from_cape_interface_pointer( interface: *mut ICapeInterface, ) -> Result<Self, COBIAError>

Get an interface wrapper instance from any interface pointer Read more
Source§

fn last_error(&self) -> Option<CapeError>

Get the last error Read more
Source§

impl Clone for CapeLibraryDetails

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Drop for CapeLibraryDetails

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.