[−][src]Struct dbus_crossroads::Context
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
impl Context
[src]
pub fn new(msg: Message) -> Option<Self>
[src]
Creates a new Context.
Usually you're not creating your own context, as the crossroads instance is creating one for you.
pub fn check<R, F: FnOnce(&mut Context) -> Result<R, MethodErr>>(
&mut self,
f: F
) -> Result<R, ()>
[src]
&mut self,
f: F
) -> Result<R, ()>
Convenience method that sets an error reply if the closure returns an error.
pub fn do_reply<F: FnOnce(&mut Message)>(&mut self, f: F)
[src]
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.
pub fn reply<OA: AppendAll>(
&mut self,
result: Result<OA, MethodErr>
) -> PhantomData<OA>
[src]
&mut self,
result: Result<OA, MethodErr>
) -> PhantomData<OA>
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.
pub fn set_reply(
&mut self,
msg: Option<Message>,
check_no_reply: bool,
check_set: bool
)
[src]
&mut self,
msg: Option<Message>,
check_no_reply: bool,
check_set: bool
)
Low-level function to set a reply
You should probably prefer do_reply, or reply_ok / reply_err for async methods.
pub fn flush_messages<S: Sender + ?Sized>(&mut self, conn: &S) -> Result<(), ()>
[src]
Low-level function to flush set messages
This is called internally, you should probably not use it.
pub fn make_signal<'b, A, N>(&self, name: N, args: A) -> Message where
A: AppendAll,
N: Into<Member<'b>>,
[src]
A: AppendAll,
N: Into<Member<'b>>,
Makes a new signal with the current interface and path
pub fn push_msg(&mut self, msg: Message)
[src]
Adds an extra message to send together with the message reply, e g, a custom signal.
pub fn path(&self) -> &Path<'static>
[src]
The current object path.
pub fn interface(&self) -> Option<&Interface<'static>>
[src]
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.
pub fn method(&self) -> &Member<'static>
[src]
The current method name.
pub fn message(&self) -> &Message
[src]
The message that caused this method to be called.
pub fn has_reply(&self) -> bool
[src]
True if a reply (error or method return) has been set.
pub fn has_error(&self) -> bool
[src]
Returns true is "reply_err" has been called, or "check" ever returned an error
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Context
impl Send for Context
impl !Sync for Context
impl Unpin for Context
impl !UnwindSafe for Context
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,