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

Provides a limited DABus like api for handler implementations.

This is passed to handlers, giving them a way of running actions on the bus that they are being run from.

Implementations

Fires an event on the bus, running appropreate handlers and returning the result. This function is similar to DABus::fire in the sense that from the outside, it behaves the same however internally it does not. see the Notes section for more details

Returns

on success, this returns the return value sent by the handler, as well as a call trace (this will change)

on failure, this returns only the call trace, which can be used to find what went wrong

Panics

if a handler that is called panics (or the runtime is broken)

Errors

if there is some (expected) error with the runtime. currently this only includes not finding an appropreate handler

Notes

like all functions on this struct, this does not execute an event iself but rather forwards it to the current runtime. this means that if useing this after the scope of the handler it was given to has ended should be considered Undefined Behavior (eventually there will be some safeguard to fix this)

takes a error (from a nested call, presumablely) and forwards it to the caller of the current event (via the runtime and a deal with the devil)

this is a easy way to handle errors, as it will forward the error, and can produce nice backtraces

Panics

it shouldent, unless something is horribly wrong with the library

Footguns
  • this function (from the perspective of the handler) will never return, but from the persepective of the program it will, so keep that in mind.

  • see the Notes section in BusInterface::fire

Trait Implementations

Formats the value using the given formatter. Read more

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.

Calls U::from(self).

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

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.