pub struct ScrapeId {
pub source: ScrapeSource,
pub subsource: Option<String>,
pub id: String,
/* private fields */
}
Expand description
Identify a scrape by source an ID.
Fields§
§source: ScrapeSource
§subsource: Option<String>
§id: String
Implementations§
Source§impl ScrapeId
impl ScrapeId
pub fn new(source: ScrapeSource, subsource: Option<String>, id: String) -> Self
Sourcepub fn is_likely_self_post(&self, url: &StoryUrl) -> bool
pub fn is_likely_self_post(&self, url: &StoryUrl) -> bool
Given a URL, determines if that URL would make this story a self-post. The current heuristic for this is whether the url’s host looks like a comments host, and the url itself contains the scrape’s ID. The latter heuristic isn’t perfect, but the failure modes are pretty harmless.
Sourcepub fn comments_url(&self) -> String
pub fn comments_url(&self) -> String
Generate a comments URL for this scrape.
pub fn from_string<S: AsRef<str>>(s: S) -> Option<Self>
Trait Implementations§
Source§impl<'de> Deserialize<'de> for ScrapeId
impl<'de> Deserialize<'de> for ScrapeId
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
Source§impl Ord for ScrapeId
impl Ord for ScrapeId
Source§impl PartialOrd for ScrapeId
impl PartialOrd for ScrapeId
impl Eq for ScrapeId
impl StructuralPartialEq for ScrapeId
Auto Trait Implementations§
impl Freeze for ScrapeId
impl RefUnwindSafe for ScrapeId
impl Send for ScrapeId
impl Sync for ScrapeId
impl Unpin for ScrapeId
impl UnwindSafe for ScrapeId
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> 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