pub struct Story<S> {
pub id: StoryIdentifier,
pub score: f32,
pub date: StoryDate,
pub url: StoryUrl,
pub title: String,
pub tags: TagSet,
pub scrapes: HashMap<ScrapeId, S>,
}
Expand description
Story scrape w/information from underlying sources.
Fields§
§id: StoryIdentifier
§score: f32
§date: StoryDate
§url: StoryUrl
§title: String
§scrapes: HashMap<ScrapeId, S>
Implementations§
Source§impl<S> Story<S>
impl<S> Story<S>
pub fn new_from_parts( title: String, url: StoryUrl, date: StoryDate, score: f32, tags: impl IntoIterator<Item = String>, scrapes: impl IntoIterator<Item = impl Into<(ScrapeId, S)>>, ) -> Self
Sourcepub fn compare_score(&self, other: &Self) -> Ordering
pub fn compare_score(&self, other: &Self) -> Ordering
Compares two stories, ordering by score.
Sourcepub fn compare_date(&self, other: &Self) -> Ordering
pub fn compare_date(&self, other: &Self) -> Ordering
Compares two stories, ordering by date.
Sourcepub fn is_likely_self_post(&self) -> bool
pub fn is_likely_self_post(&self) -> bool
Is this story likely a self-post? See the description of ScrapeId::is_likely_self_post
for details of the
heuristic and caveats.
pub fn render(&self, eval: &StoryEvaluator, order: usize) -> StoryRender
Trait Implementations§
Source§impl<'de, S> Deserialize<'de> for Story<S>where
S: Deserialize<'de>,
impl<'de, S> Deserialize<'de> for Story<S>where
S: Deserialize<'de>,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl<S> Freeze for Story<S>
impl<S> RefUnwindSafe for Story<S>where
S: RefUnwindSafe,
impl<S> Send for Story<S>where
S: Send,
impl<S> Sync for Story<S>where
S: Sync,
impl<S> Unpin for Story<S>where
S: Unpin,
impl<S> UnwindSafe for Story<S>where
S: UnwindSafe,
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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
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