pub struct ThreadLoop { /* private fields */ }Expand description
Thread loop that generates and posts educational threads.
Implementations§
Source§impl ThreadLoop
impl ThreadLoop
Sourcepub async fn run(
&self,
cancel: CancellationToken,
scheduler: LoopScheduler,
schedule: Option<Arc<ActiveSchedule>>,
)
pub async fn run( &self, cancel: CancellationToken, scheduler: LoopScheduler, schedule: Option<Arc<ActiveSchedule>>, )
Run the continuous thread loop until cancellation.
Sourcepub async fn run_once(
&self,
topic: Option<&str>,
count: Option<usize>,
) -> ThreadResult
pub async fn run_once( &self, topic: Option<&str>, count: Option<usize>, ) -> ThreadResult
Run a single thread generation (for CLI tuitbot thread command).
If topic is provided, uses that topic. Otherwise picks a random one.
If count is provided, generates exactly that many tweets (clamped 2-15).
Source§impl ThreadLoop
impl ThreadLoop
Sourcepub fn new(
generator: Arc<dyn ThreadGenerator>,
safety: Arc<dyn ContentSafety>,
storage: Arc<dyn ContentStorage>,
poster: Arc<dyn ThreadPoster>,
topics: Vec<String>,
thread_interval_secs: u64,
dry_run: bool,
) -> Self
pub fn new( generator: Arc<dyn ThreadGenerator>, safety: Arc<dyn ContentSafety>, storage: Arc<dyn ContentStorage>, poster: Arc<dyn ThreadPoster>, topics: Vec<String>, thread_interval_secs: u64, dry_run: bool, ) -> Self
Create a new thread loop.
Auto Trait Implementations§
impl Freeze for ThreadLoop
impl !RefUnwindSafe for ThreadLoop
impl Send for ThreadLoop
impl Sync for ThreadLoop
impl Unpin for ThreadLoop
impl UnsafeUnpin for ThreadLoop
impl !UnwindSafe for ThreadLoop
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more