pub struct MockSource { /* private fields */ }Expand description
A mock source for testing that returns predefined responses.
Implementations§
Source§impl MockSource
impl MockSource
Sourcepub fn set_search_response(&self, response: SearchResponse)
pub fn set_search_response(&self, response: SearchResponse)
Set the search response to return.
Sourcepub fn clear_response(&self)
pub fn clear_response(&self)
Clear the configured response.
Trait Implementations§
Source§impl Clone for MockSource
impl Clone for MockSource
Source§fn clone(&self) -> MockSource
fn clone(&self) -> MockSource
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for MockSource
impl Debug for MockSource
Source§impl Default for MockSource
impl Default for MockSource
Source§fn default() -> MockSource
fn default() -> MockSource
Returns the “default value” for a type. Read more
Source§impl Source for MockSource
impl Source for MockSource
Source§fn id(&self) -> &str
fn id(&self) -> &str
Unique identifier for this source (used in tool names, e.g., “arxiv”, “pubmed”)
Source§fn capabilities(&self) -> SourceCapabilities
fn capabilities(&self) -> SourceCapabilities
Describe the capabilities of this source
Source§fn search<'life0, 'life1, 'async_trait>(
&'life0 self,
query: &'life1 SearchQuery,
) -> Pin<Box<dyn Future<Output = Result<SearchResponse, SourceError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn search<'life0, 'life1, 'async_trait>(
&'life0 self,
query: &'life1 SearchQuery,
) -> Pin<Box<dyn Future<Output = Result<SearchResponse, SourceError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Search for papers matching the query
Source§fn supports_search(&self) -> bool
fn supports_search(&self) -> bool
Whether this source supports search
Source§fn supports_download(&self) -> bool
fn supports_download(&self) -> bool
Whether this source supports downloading PDFs
Source§fn supports_read(&self) -> bool
fn supports_read(&self) -> bool
Whether this source supports reading/parsing PDFs
Source§fn supports_citations(&self) -> bool
fn supports_citations(&self) -> bool
Whether this source supports citation/reference lookup
Source§fn supports_doi_lookup(&self) -> bool
fn supports_doi_lookup(&self) -> bool
Whether this source supports lookup by DOI
Whether this source supports author search
Search for papers by a specific author
Source§fn download<'life0, 'life1, 'async_trait>(
&'life0 self,
_request: &'life1 DownloadRequest,
) -> Pin<Box<dyn Future<Output = Result<DownloadResult, SourceError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn download<'life0, 'life1, 'async_trait>(
&'life0 self,
_request: &'life1 DownloadRequest,
) -> Pin<Box<dyn Future<Output = Result<DownloadResult, SourceError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Download a paper’s PDF to the specified path
Source§fn read<'life0, 'life1, 'async_trait>(
&'life0 self,
_request: &'life1 ReadRequest,
) -> Pin<Box<dyn Future<Output = Result<ReadResult, SourceError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn read<'life0, 'life1, 'async_trait>(
&'life0 self,
_request: &'life1 ReadRequest,
) -> Pin<Box<dyn Future<Output = Result<ReadResult, SourceError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Read and extract text from a paper’s PDF
Source§fn get_citations<'life0, 'life1, 'async_trait>(
&'life0 self,
_request: &'life1 CitationRequest,
) -> Pin<Box<dyn Future<Output = Result<SearchResponse, SourceError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_citations<'life0, 'life1, 'async_trait>(
&'life0 self,
_request: &'life1 CitationRequest,
) -> Pin<Box<dyn Future<Output = Result<SearchResponse, SourceError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Get papers that cite this paper
Source§fn get_references<'life0, 'life1, 'async_trait>(
&'life0 self,
_request: &'life1 CitationRequest,
) -> Pin<Box<dyn Future<Output = Result<SearchResponse, SourceError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_references<'life0, 'life1, 'async_trait>(
&'life0 self,
_request: &'life1 CitationRequest,
) -> Pin<Box<dyn Future<Output = Result<SearchResponse, SourceError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Get papers referenced by this paper
Get related papers
Source§fn get_by_doi<'life0, 'life1, 'async_trait>(
&'life0 self,
_doi: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Paper, SourceError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_by_doi<'life0, 'life1, 'async_trait>(
&'life0 self,
_doi: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Paper, SourceError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Get a paper by its DOI
Source§fn get_by_id<'life0, 'life1, 'async_trait>(
&'life0 self,
_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Paper, SourceError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_by_id<'life0, 'life1, 'async_trait>(
&'life0 self,
_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Paper, SourceError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Get a paper by its ID (source-specific)
Source§fn validate_id(&self, _id: &str) -> Result<(), SourceError>
fn validate_id(&self, _id: &str) -> Result<(), SourceError>
Validate that a paper ID is correctly formatted for this source
Auto Trait Implementations§
impl Freeze for MockSource
impl RefUnwindSafe for MockSource
impl Send for MockSource
impl Sync for MockSource
impl Unpin for MockSource
impl UnwindSafe for MockSource
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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