pub struct ContentLoop { /* private fields */ }Expand description
Content loop that generates and posts original educational tweets.
Implementations§
Source§impl ContentLoop
impl ContentLoop
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 content loop until cancellation.
Sourcepub async fn run_once(&self, topic: Option<&str>) -> ContentResult
pub async fn run_once(&self, topic: Option<&str>) -> ContentResult
Run a single content generation (for CLI tuitbot post command).
If topic is provided, uses that topic. Otherwise picks a random
topic from the configured list.
Source§impl ContentLoop
impl ContentLoop
Sourcepub fn new(
generator: Arc<dyn TweetGenerator>,
safety: Arc<dyn ContentSafety>,
storage: Arc<dyn ContentStorage>,
topics: Vec<String>,
post_window_secs: u64,
dry_run: bool,
) -> Self
pub fn new( generator: Arc<dyn TweetGenerator>, safety: Arc<dyn ContentSafety>, storage: Arc<dyn ContentStorage>, topics: Vec<String>, post_window_secs: u64, dry_run: bool, ) -> Self
Create a new content loop.
Sourcepub fn with_topic_scorer(self, scorer: Arc<dyn TopicScorer>) -> Self
pub fn with_topic_scorer(self, scorer: Arc<dyn TopicScorer>) -> Self
Set a topic scorer for epsilon-greedy topic selection.
When set, 80% of the time the loop picks from top-performing topics (exploit), and 20% of the time it picks a random topic (explore).
Sourcepub fn with_thread_poster(self, poster: Arc<dyn ThreadPoster>) -> Self
pub fn with_thread_poster(self, poster: Arc<dyn ThreadPoster>) -> Self
Set a thread poster for posting scheduled threads as reply chains.
Auto Trait Implementations§
impl Freeze for ContentLoop
impl !RefUnwindSafe for ContentLoop
impl Send for ContentLoop
impl Sync for ContentLoop
impl Unpin for ContentLoop
impl UnsafeUnpin for ContentLoop
impl !UnwindSafe for ContentLoop
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