Skip to main content

tulpje_framework/context/
task_context.rs

1use std::sync::Arc;
2use twilight_http::Client;
3use twilight_model::id::{Id, marker::ApplicationMarker};
4use twilight_standby::Standby;
5
6use super::Context;
7
8#[derive(Debug)]
9pub struct TaskContext<T: Clone + Send + Sync> {
10    pub application_id: Id<ApplicationMarker>,
11    pub services: Arc<T>,
12    pub client: Arc<Client>,
13    pub standby: Arc<Standby>,
14}
15
16impl<T: Clone + Send + Sync> TaskContext<T> {
17    pub fn from_context(ctx: Context<T>) -> Self {
18        Self {
19            application_id: ctx.application_id,
20            services: ctx.services,
21            client: ctx.client,
22            standby: ctx.standby,
23        }
24    }
25}