Skip to main content

DeviceEdgeSession

Struct DeviceEdgeSession 

Source
pub struct DeviceEdgeSession { /* private fields */ }
Expand description

A device edge session whose identity survives transport route changes.

The session owns a stable id, a stable ledger reference, a mutable current link, an optional device profile binding, an event ledger, a route order, a command queue, and optional visible consent data. Rebinding changes only the route; the id, ledger reference, event history, queued commands, profile, and bound consent remain attached to the same session.

Implementations§

Source§

impl DeviceEdgeSession

Source

pub fn new(id: Symbol, link: LinkKind) -> Result<Self>

Creates a device edge session using the id as the ledger reference.

Source

pub fn with_ledger( id: Symbol, link: LinkKind, ledger: LedgerRef, ) -> Result<Self>

Creates a device edge session with an explicit ledger reference.

Source

pub fn id(&self) -> &Symbol

Returns the stable session id.

Returns the current route carrying this session.

Source

pub fn ledger_ref(&self) -> &LedgerRef

Returns the stable ledger reference.

Source

pub fn device_profile(&self) -> Option<&DeviceEdgeProfile>

Returns the profile bound to this session, if one was registered.

Source

pub fn bind_profile(&mut self, profile: DeviceEdgeProfile) -> Result<()>

Binds provider/profile metadata to the session.

Source

pub fn route_order(&self) -> &[LinkKind]

Returns the preferred route order for this session.

Source

pub fn set_route_order(&mut self, route_order: Vec<LinkKind>) -> Result<()>

Replaces the preferred route order.

Source

pub fn queue_command(&mut self, command: Expr) -> Result<()>

Queues an actuator command while the current route is unavailable.

Source

pub fn queued_command_count(&self) -> usize

Returns the number of queued commands waiting for a route.

Source

pub fn flushed_commands(&self) -> &[Expr]

Returns the commands flushed after route reconnects.

Source

pub fn flush_queued_commands(&mut self) -> Result<Vec<Expr>>

Flushes queued actuator commands after a route reconnects.

Source

pub fn event_ledger(&self) -> &EventLedger

Returns the session event ledger.

Returns the visible consent data bound to the session, if present.

Returns the session symbol embedded in the bound consent data, if any.

Binds visible consent data to the session and records the ledger event.

Source

pub fn rebind(&mut self, link: LinkKind) -> Result<()>

Swaps the transport route without changing the session identity.

Source

pub fn rebind_and_flush(&mut self, link: LinkKind) -> Result<Vec<Expr>>

Swaps the route and flushes queued commands after the reconnect.

Trait Implementations§

Source§

impl Clone for DeviceEdgeSession

Source§

fn clone(&self) -> DeviceEdgeSession

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for DeviceEdgeSession

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. 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.