[][src]Struct vk_bot::context::Context

pub struct Context { /* fields omitted */ }

Stores information necessary for handlers, allows to send the resulting message.

Methods

impl Context[src]

pub fn new(
    event: Event,
    req: &CallbackAPIRequest,
    api: Arc<Mutex<APIClient>>
) -> Self
[src]

Creates a new Context.

Panics

pub fn group_id(&self) -> i32[src]

Returns the group ID.

pub fn event(&self) -> Event[src]

Returns the original Callback API event type that caused this handler to run.

pub fn object(&self) -> &Object[src]

Returns the object associated with the event (given by Callback API).

pub fn api(&self) -> Arc<Mutex<APIClient>>[src]

Returns an rvk::APIClient, wrapped into Arc<Mutex<...>>.

pub fn response(&mut self) -> &mut Response[src]

Returns the current pending response object (mutable).

pub fn send(&self) -> Result<(), Error>[src]

Sends the response.

This does not erase the response object. You can send multiple messages.

This method currently blocks until the rvk::APIClient is available, so only one message is being sent at a given time. This behavior may change.

Trait Implementations

impl Debug for Context[src]

Auto Trait Implementations

impl Send for Context

impl Sync for Context

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Typeable for T where
    T: Any

fn get_type(&self) -> TypeId

Get the TypeId of this object.

impl<T> IntoCollection for T

impl<T, I> AsResult for T where
    I: Input, 

impl<T> Erased for T