pub struct TelegramContext {
pub init_data: TelegramInitData,
pub theme_params: TelegramThemeParams,
}
Expand description
Global context of the Telegram Mini App, initialized once per app session.
Fields§
§init_data: TelegramInitData
§theme_params: TelegramThemeParams
Implementations§
Source§impl TelegramContext
impl TelegramContext
Sourcepub fn init(
init_data: TelegramInitData,
theme_params: TelegramThemeParams,
) -> Result<(), &'static str>
pub fn init( init_data: TelegramInitData, theme_params: TelegramThemeParams, ) -> Result<(), &'static str>
Initializes the global Telegram context.
§Errors
Returns an error if the context was already initialized.
Sourcepub fn get<F, R>(f: F) -> Option<R>where
F: FnOnce(&TelegramContext) -> R,
pub fn get<F, R>(f: F) -> Option<R>where
F: FnOnce(&TelegramContext) -> R,
Access the global context if it has been initialized.
Accepts a closure and returns the result of applying it to the context.
Trait Implementations§
Source§impl Clone for TelegramContext
impl Clone for TelegramContext
Source§fn clone(&self) -> TelegramContext
fn clone(&self) -> TelegramContext
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl Freeze for TelegramContext
impl RefUnwindSafe for TelegramContext
impl Send for TelegramContext
impl Sync for TelegramContext
impl Unpin for TelegramContext
impl UnwindSafe for TelegramContext
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more