Simplify lifetimes
I think I may have overdone it with lifetime-per-dependency, I doubt that'll ever become necessary
This commit is contained in:
parent
9d3cd75db9
commit
832bdf6e92
|
@ -4,25 +4,25 @@ use async_trait::async_trait;
|
||||||
use crate::services::bluesky::{Bluesky, Operation, OperationProcessor};
|
use crate::services::bluesky::{Bluesky, Operation, OperationProcessor};
|
||||||
use crate::services::database::Database;
|
use crate::services::database::Database;
|
||||||
|
|
||||||
pub struct PostSaver<'a, 'b> {
|
pub struct PostSaver<'a> {
|
||||||
database: &'a Database,
|
database: &'a Database,
|
||||||
bluesky: &'b Bluesky,
|
bluesky: &'a Bluesky,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, 'b> PostSaver<'a, 'b> {
|
impl<'a> PostSaver<'a> {
|
||||||
pub fn new(database: &'a Database, bluesky: &'b Bluesky) -> Self {
|
pub fn new(database: &'a Database, bluesky: &'a Bluesky) -> Self {
|
||||||
Self { database, bluesky }
|
Self { database, bluesky }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, 'b> PostSaver<'a, 'b> {
|
impl<'a> PostSaver<'a> {
|
||||||
pub async fn start(&self) -> Result<()> {
|
pub async fn start(&self) -> Result<()> {
|
||||||
Ok(self.bluesky.subscribe_to_operations(self).await?)
|
Ok(self.bluesky.subscribe_to_operations(self).await?)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[async_trait]
|
#[async_trait]
|
||||||
impl<'a, 'b> OperationProcessor for PostSaver<'a, 'b> {
|
impl<'a> OperationProcessor for PostSaver<'a> {
|
||||||
async fn process_operation(&self, operation: &Operation) -> Result<()> {
|
async fn process_operation(&self, operation: &Operation) -> Result<()> {
|
||||||
match operation {
|
match operation {
|
||||||
Operation::CreatePost {
|
Operation::CreatePost {
|
||||||
|
|
|
@ -6,14 +6,14 @@ use crate::services::ai::AI;
|
||||||
use crate::services::bluesky::Bluesky;
|
use crate::services::bluesky::Bluesky;
|
||||||
use crate::services::database::Database;
|
use crate::services::database::Database;
|
||||||
|
|
||||||
pub struct ProfileClassifier<'a, 'b, 'c> {
|
pub struct ProfileClassifier<'a> {
|
||||||
database: &'a Database,
|
database: &'a Database,
|
||||||
ai: &'b AI,
|
ai: &'a AI,
|
||||||
bluesky: &'c Bluesky,
|
bluesky: &'a Bluesky,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, 'b, 'c> ProfileClassifier<'a, 'b, 'c> {
|
impl<'a> ProfileClassifier<'a> {
|
||||||
pub fn new(database: &'a Database, ai: &'b AI, bluesky: &'c Bluesky) -> Self {
|
pub fn new(database: &'a Database, ai: &'a AI, bluesky: &'a Bluesky) -> Self {
|
||||||
Self {
|
Self {
|
||||||
database,
|
database,
|
||||||
ai,
|
ai,
|
||||||
|
|
Loading…
Reference in New Issue