pub struct Engine { /* private fields */ }Expand description
书源运行时引擎。
Implementations§
Source§impl Engine
impl Engine
Sourcepub fn new(source: BookSource) -> Result<Self>
pub fn new(source: BookSource) -> Result<Self>
用默认 reqwest 取页后端构建。
Sourcepub fn with_fetcher(source: BookSource, fetcher: Arc<dyn Fetcher>) -> Self
pub fn with_fetcher(source: BookSource, fetcher: Arc<dyn Fetcher>) -> Self
注入自定义取页后端(便于测试替身 / 反爬适配器)。
Sourcepub fn source(&self) -> &BookSource
pub fn source(&self) -> &BookSource
暴露只读配置。
Sourcepub async fn search(
&self,
key: &str,
page: u32,
page_size: u32,
) -> Result<Vec<BookListItem>>
pub async fn search( &self, key: &str, page: u32, page_size: u32, ) -> Result<Vec<BookListItem>>
搜索。
Sourcepub async fn explore(
&self,
category_url: &UrlOrRule,
page: u32,
page_size: u32,
) -> Result<Vec<BookListItem>>
pub async fn explore( &self, category_url: &UrlOrRule, page: u32, page_size: u32, ) -> Result<Vec<BookListItem>>
浏览某分类的某一页。
Sourcepub fn explore_categories(&self) -> Vec<Category>
pub fn explore_categories(&self) -> Vec<Category>
浏览分类列表,供上层选择后翻页。
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Engine
impl !UnwindSafe for Engine
impl Freeze for Engine
impl Send for Engine
impl Sync for Engine
impl Unpin for Engine
impl UnsafeUnpin for Engine
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
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,
impl<T> ErasedDestructor for Twhere
T: 'static,
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> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Returns the layout of the type.
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Returns whether the given value has been niched. Read more
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
Writes data to
out indicating that a T is niched.