tulpje_framework/context/
task_context.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
use std::sync::Arc;
use twilight_http::Client;
use twilight_model::id::{marker::ApplicationMarker, Id};

use super::Context;

#[derive(Debug)]
pub struct TaskContext<T: Clone + Send + Sync> {
    pub application_id: Id<ApplicationMarker>,
    pub services: Arc<T>,
    pub client: Arc<Client>,
}

impl<T: Clone + Send + Sync> TaskContext<T> {
    pub fn from_context(ctx: Context<T>) -> Self {
        Self {
            application_id: ctx.application_id,
            services: ctx.services,
            client: ctx.client,
        }
    }
}