pub struct BaseThing { /* private fields */ }
Expand description

Basic web thing implementation.

This can easily be used by other things to handle most of the boring work.

Implementations

Create a new BaseThing.

Arguments
  • id - the thing’s unique ID - must be a URI
  • title - the thing’s title
  • type_ - the thing’s type(s)
  • description - description of the thing
  • context - vocabularies to be used in the thing description

Overwrite the Thing Description context with a new set of vocabularies.

Trait Implementations

Returns the “default value” for a type. Read more

Return the thing state as a Thing Description.

Return this thing as an Any.

Return this thing as a mutable Any.

Get this thing’s href.

Get this thing’s href prefix, i.e. /0.

Get the UI href.

Set the prefix of any hrefs associated with this thing.

Set the href of this thing’s custom UI.

Get the ID of the thing.

Get the title of the thing.

Get the type context of the thing.

Get the type(s) of the thing.

Get the description of the thing.

Get the thing’s properties as a JSON map.

Returns the properties as a JSON map, i.e. name -> description.

Get the thing’s actions as an array.

Get the thing’s events as an array.

Add a property to this thing.

Remove a property from this thing.

Find a property by name.

Get a property’s value.

Get a mapping of all properties and their values.

Returns an object of propertyName -> value.

Determine whether or not this thing has a given property.

Get an action.

Add a new event and notify subscribers.

Add an available event.

Arguments
  • name - name of the event
  • metadata - event metadata, i.e. type, description, etc., as a JSON map

Perform an action on the thing.

Returns the action that was created.

Remove an existing action.

Returns a boolean indicating the presence of the action.

Add an available action.

Arguments
  • name - name of the action
  • metadata - action metadata, i.e. type, description, etc., as a JSON map

Add a new websocket subscriber.

Arguments
  • ws_id - ID of the websocket

Remove a websocket subscriber.

Arguments
  • ws_id - ID of the websocket

Add a new websocket subscriber to an event.

Arguments
  • name - name of the event
  • ws_id - ID of the websocket

Remove a websocket subscriber from an event.

Arguments
  • name - name of the event
  • ws_id - ID of the websocket

Notify all subscribers of a property change.

Notify all subscribers of an action status change.

Notify all subscribers of an event.

Start the specified action.

Cancel the specified action.

Finish the specified action.

Drain any message queues for the specified weboscket ID.

Arguments
  • ws_id - ID of the websocket
Set a property value.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more