pub struct FeedCatalog { /* private fields */ }Expand description
Wraps a parsed FeedManifest and exposes filter, search, and
find-by-name helpers for consumer code that wants to browse what a
publisher offers.
Implementations§
Source§impl FeedCatalog
impl FeedCatalog
Sourcepub fn new(manifest: FeedManifest) -> Self
pub fn new(manifest: FeedManifest) -> Self
Take ownership of a manifest.
Sourcepub fn from_json_str(s: &str) -> Result<Self>
pub fn from_json_str(s: &str) -> Result<Self>
Parse a manifest from a JSON string.
pub fn manifest(&self) -> &FeedManifest
pub fn into_manifest(self) -> FeedManifest
pub fn protocol_version(&self) -> u32
pub fn server_version(&self) -> &str
pub fn feeds(&self) -> &[FeedDescriptor]
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Sourcepub fn find(&self, name: &str) -> Option<&FeedDescriptor>
pub fn find(&self, name: &str) -> Option<&FeedDescriptor>
Locate a feed by exact name.
Sourcepub fn filter_by_tag<'a>(
&'a self,
tag: &'a str,
) -> impl Iterator<Item = &'a FeedDescriptor> + 'a
pub fn filter_by_tag<'a>( &'a self, tag: &'a str, ) -> impl Iterator<Item = &'a FeedDescriptor> + 'a
All feeds carrying the given tag.
Sourcepub fn filter_by_transport(
&self,
t: TransportTag,
) -> impl Iterator<Item = &FeedDescriptor>
pub fn filter_by_transport( &self, t: TransportTag, ) -> impl Iterator<Item = &FeedDescriptor>
All feeds advertising the given transport.
Sourcepub fn filter_by_format(
&self,
f: FormatPreference,
) -> impl Iterator<Item = &FeedDescriptor>
pub fn filter_by_format( &self, f: FormatPreference, ) -> impl Iterator<Item = &FeedDescriptor>
All feeds advertising the given format.
Sourcepub fn search<'a>(
&'a self,
query: &'a str,
) -> impl Iterator<Item = &'a FeedDescriptor> + 'a
pub fn search<'a>( &'a self, query: &'a str, ) -> impl Iterator<Item = &'a FeedDescriptor> + 'a
Case-insensitive substring match on feed name or description.
Trait Implementations§
Source§impl Clone for FeedCatalog
impl Clone for FeedCatalog
Source§fn clone(&self) -> FeedCatalog
fn clone(&self) -> FeedCatalog
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 FeedCatalog
impl Debug for FeedCatalog
Source§impl From<FeedManifest> for FeedCatalog
impl From<FeedManifest> for FeedCatalog
Source§fn from(m: FeedManifest) -> Self
fn from(m: FeedManifest) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for FeedCatalog
impl RefUnwindSafe for FeedCatalog
impl Send for FeedCatalog
impl Sync for FeedCatalog
impl Unpin for FeedCatalog
impl UnsafeUnpin for FeedCatalog
impl UnwindSafe for FeedCatalog
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