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

Context is the struct that accompanies you through your method call handler, providing helpful information about the message sent from the client, as well as some methods to send extra messages (typically signals) in return.

Implementations§

Creates a new Context.

Usually you’re not creating your own context, as the crossroads instance is creating one for you.

Convenience method that sets an error reply if the closure returns an error.

If the reply is not already set, creates a new method return message and calls the closure so that the closure can fill in the arguments.

Replies to the incoming message, if the reply is not already set. This is what you’ll normally have last in your async method.

Returns PhantomData just to aid the type system.

Low-level function to set a reply

You should probably prefer do_reply, or reply_ok / reply_err for async methods.

Low-level function to flush set messages

This is called internally, you should probably not use it.

Makes a new signal with the current interface and path

Adds an extra message to send together with the message reply, e g, a custom signal.

The current object path.

The current interface name.

The D-Bus specfication allows for the interface to be unspecified, hence this returns an option. This is very rarely used in practice.

The current method name.

The message that caused this method to be called.

True if a reply (error or method return) has been set.

Returns true is “reply_err” has been called, or “check” ever returned an error

Trait Implementations§

Formats the value using the given formatter. Read more
Executes the destructor for this type. 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.