pub struct DiscoveryLoop { /* private fields */ }Expand description
Discovery loop that finds and replies to relevant tweets.
Implementations§
Source§impl DiscoveryLoop
impl DiscoveryLoop
Sourcepub fn new(
searcher: Arc<dyn TweetSearcher>,
scorer: Arc<dyn TweetScorer>,
generator: Arc<dyn ReplyGenerator>,
safety: Arc<dyn SafetyChecker>,
storage: Arc<dyn LoopStorage>,
poster: Arc<dyn PostSender>,
keywords: Vec<String>,
threshold: f32,
dry_run: bool,
) -> Self
pub fn new( searcher: Arc<dyn TweetSearcher>, scorer: Arc<dyn TweetScorer>, generator: Arc<dyn ReplyGenerator>, safety: Arc<dyn SafetyChecker>, storage: Arc<dyn LoopStorage>, poster: Arc<dyn PostSender>, keywords: Vec<String>, threshold: f32, dry_run: bool, ) -> Self
Create a new discovery loop.
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 discovery loop until cancellation.
Rotates through keywords across iterations to distribute API usage.
Sourcepub async fn run_once(
&self,
limit: Option<usize>,
) -> Result<(Vec<DiscoveryResult>, DiscoverySummary), LoopError>
pub async fn run_once( &self, limit: Option<usize>, ) -> Result<(Vec<DiscoveryResult>, DiscoverySummary), LoopError>
Run a single-shot discovery across all keywords.
Used by the CLI tuitbot discover command. Searches all keywords
(not rotating) and returns all results sorted by score descending.
Auto Trait Implementations§
impl Freeze for DiscoveryLoop
impl !RefUnwindSafe for DiscoveryLoop
impl Send for DiscoveryLoop
impl Sync for DiscoveryLoop
impl Unpin for DiscoveryLoop
impl UnsafeUnpin for DiscoveryLoop
impl !UnwindSafe for DiscoveryLoop
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