Skip to main content

IotHubModuleClient

Struct IotHubModuleClient 

Source
pub struct IotHubModuleClient<C: ModuleEventCallback> { /* private fields */ }

Implementations§

Source§

impl<C: ModuleEventCallback> IotHubModuleClient<C>

Source

pub fn create_from_environment( protocol: TransportProvider, callback: C, ) -> Result<Self, IotError>

Source

pub fn create_from_connection_string( connection_string: &str, transport: TransportProvider, callback: C, ) -> Result<Self, IotError>

Source

pub fn try_new(callback: C) -> Result<Self, IotError>

Examples found in repository?
examples/basic.rs (line 37)
34fn main() {
35    println!("azure-iot-rs example CLI — starting client...");
36
37    let mut client = IotHubModuleClient::try_new(PrintModuleEvents).unwrap();
38
39    println!("Client initialized. Entering work loop (Ctrl+C to exit)...");
40    client.do_work();
41}
Source

pub async fn send_event_async( &mut self, message: &IotHubMessage, ) -> Result<(), IotError>

Source

pub async fn send_message_result( &mut self, message: &IotHubMessage, ) -> Result<IoTHubClientConfirmationResult, IotError>

Source

pub async fn send_message( &mut self, message: &IotHubMessage, ) -> Result<IoTHubClientConfirmationResult, IotError>

Source

pub fn get_send_status(&self) -> Result<(), IotError>

Source

pub fn set_retry_policy( &self, retry_policy: IOTHUB_CLIENT_RETRY_POLICY, retry_timeout_limit_in_seconds: usize, ) -> Result<(), IotError>

Source

pub fn get_retry_policy( &self, ) -> Result<(IOTHUB_CLIENT_RETRY_POLICY, usize), IotError>

Source

pub fn get_last_message_receive_time(&self) -> Result<SystemTime, IotError>

Source

pub fn do_work_once(&self) -> Result<(), IotError>

Source

pub fn do_work(&mut self)

Examples found in repository?
examples/basic.rs (line 40)
34fn main() {
35    println!("azure-iot-rs example CLI — starting client...");
36
37    let mut client = IotHubModuleClient::try_new(PrintModuleEvents).unwrap();
38
39    println!("Client initialized. Entering work loop (Ctrl+C to exit)...");
40    client.do_work();
41}
Source

pub fn set_option_value<T>( &self, option_name: &str, value: &T, ) -> Result<(), IotError>

Source

pub fn send_reported_state( &mut self, reported_state: &[u8], callback: IOTHUB_CLIENT_REPORTED_STATE_CALLBACK, ) -> Result<(), IotError>

Source

pub async fn get_twin_async( &mut self, ) -> Result<(IotHubDeviceTwinUpdateState, Vec<u8>), IotError>

Source

pub async fn send_event_to_output_async( &mut self, message: &IotHubMessage, output_name: &CStr, ) -> Result<IoTHubClientConfirmationResult, IotError>

Source

pub fn device_method_invoke( &self, device_id: &str, method_name: &str, method_payload: &str, timeout: Duration, ) -> Result<MethodInvokeResponse, IotError>

Source

pub fn module_method_invoke( &self, device_id: &str, module_id: &str, method_name: &str, method_payload: &str, timeout: c_uint, ) -> Result<MethodInvokeResponse, IotError>

Source

pub fn send_message_disposition( &self, message: &IotHubMessage, disposition: IOTHUBMESSAGE_DISPOSITION_RESULT, ) -> Result<(), IotError>

Source

pub async fn send_telemetry_async( &mut self, message: &IotHubMessage, ) -> Result<IoTHubClientConfirmationResult, IotError>

Source

pub fn subscribe_to_commands( &mut self, callback: IOTHUB_CLIENT_COMMAND_CALLBACK_ASYNC, ) -> Result<(), IotError>

Source

pub async fn send_properties_async( &mut self, properties: &[u8], ) -> Result<c_int, IotError>

Source

pub async fn get_properties_async( &mut self, ) -> Result<(IoTHubClientPropertyPayloadType, Vec<u8>), IotError>

Source

pub async fn get_properties_and_subscribe_to_updates_async( &mut self, ) -> Result<(IoTHubClientPropertyPayloadType, Vec<u8>), IotError>

Source

pub fn set_option(&self, option: ModuleClientOption<'_>) -> Result<(), IotError>

Trait Implementations§

Source§

impl<C: ModuleEventCallback> Drop for IotHubModuleClient<C>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl<C: ModuleEventCallback + Send> Send for IotHubModuleClient<C>

Auto Trait Implementations§

§

impl<C> Freeze for IotHubModuleClient<C>
where C: Freeze,

§

impl<C> RefUnwindSafe for IotHubModuleClient<C>
where C: RefUnwindSafe,

§

impl<C> !Sync for IotHubModuleClient<C>

§

impl<C> Unpin for IotHubModuleClient<C>
where C: Unpin,

§

impl<C> UnsafeUnpin for IotHubModuleClient<C>
where C: UnsafeUnpin,

§

impl<C> UnwindSafe for IotHubModuleClient<C>
where C: UnwindSafe,

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.