pub struct IoTScapeService<SocketType: SocketTrait = UdpSocket> {
    pub definition: ServiceDefinition,
    pub name: String,
    pub next_msg_id: u64,
    pub rx_queue: VecDeque<Request>,
    pub tx_queue: VecDeque<Response>,
    /* private fields */
}

Fields§

§definition: ServiceDefinition§name: String§next_msg_id: u64§rx_queue: VecDeque<Request>§tx_queue: VecDeque<Response>

Implementations§

source§

impl<SocketType: SocketTrait> IoTScapeService<SocketType>

source

pub fn new( name: &str, definition: ServiceDefinition, server: SocketAddr ) -> Self

source

pub fn announce(&mut self) -> Result<usize, String>

Send the service description to the server

source

pub fn poll(&mut self, timeout: Option<Duration>)

Handle rx/tx

source

pub fn enqueue_response_to( &mut self, request: Request, params: Result<Vec<Value>, String> ) -> Result<usize, String>

Create a response to an Request and enqueue it for sending

source

pub fn send_event( &mut self, call_id: &str, event_type: &str, args: BTreeMap<String, String> ) -> Result<usize, String>

Set an event message to be sent

Auto Trait Implementations§

§

impl<SocketType> RefUnwindSafe for IoTScapeService<SocketType>
where SocketType: RefUnwindSafe,

§

impl<SocketType> Send for IoTScapeService<SocketType>
where SocketType: Send,

§

impl<SocketType> Sync for IoTScapeService<SocketType>
where SocketType: Sync,

§

impl<SocketType> Unpin for IoTScapeService<SocketType>
where SocketType: Unpin,

§

impl<SocketType> UnwindSafe for IoTScapeService<SocketType>
where SocketType: 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>,

§

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>,

§

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.