#[repr(u8)]pub enum LinkLocality {
SelfLink = 0,
InLink = 1,
OutLink = 2,
}
Expand description
Describes the link destinations relation to the page it is on.
A site is by default equivalent to a hostname.
Exceptions:
- A site that hosts different sites on subpaths, protocols or ports
- Multiple hosts might be considered hostig the same Site
Variants§
SelfLink = 0
Self-Links link inside the document and only change the fragment
InLink = 1
In-Links link to a different document on the same site
OutLink = 2
Out-Links leave the site they are on. It is a safe fallback and returned by Default::default()
.
Implementations§
Source§impl LinkLocality
impl LinkLocality
Sourcepub fn new(link_url: &Url, document_url: &Url) -> Self
pub fn new(link_url: &Url, document_url: &Url) -> Self
A classifier that implements some sane defaults.
It is intented to produce okay results without any configuration.
Rules:
- link_url without host => OutLink
- Different host => OutLink
- Different port => OutLink
- Different scheme after removing trailing ‘s’ => Outlink
- Different path => InLink
- Different query => InLink
- Else => SelfLink
Wrapping this function to produce configurable and more sophisticated behavior is encouraged.
Sourcepub fn from_u8_or_outlink(id: u8) -> Self
pub fn from_u8_or_outlink(id: u8) -> Self
A guaranteed to succeed number to enum converter, that converts all unknown numbers to outlinks
Trait Implementations§
Source§impl AsInteger for LinkLocality
impl AsInteger for LinkLocality
Source§fn as_criterium_i64(&self) -> i64
fn as_criterium_i64(&self) -> i64
Converts whatever implements this trait into an i64 for comparing against some other number using a NumberCriterium.
Source§impl Clone for LinkLocality
impl Clone for LinkLocality
Source§fn clone(&self) -> LinkLocality
fn clone(&self) -> LinkLocality
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 LinkLocality
impl Debug for LinkLocality
Source§impl Default for LinkLocality
impl Default for LinkLocality
Source§impl<'de> Deserialize<'de> for LinkLocality
impl<'de> Deserialize<'de> for LinkLocality
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 PartialEq for LinkLocality
impl PartialEq for LinkLocality
Source§impl Serialize for LinkLocality
impl Serialize for LinkLocality
impl Eq for LinkLocality
impl StructuralPartialEq for LinkLocality
Auto Trait Implementations§
impl Freeze for LinkLocality
impl RefUnwindSafe for LinkLocality
impl Send for LinkLocality
impl Sync for LinkLocality
impl Unpin for LinkLocality
impl UnwindSafe for LinkLocality
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> IntoWithEntityGenerationId<T> for Twhere
T: Clone,
impl<T> IntoWithEntityGenerationId<T> for Twhere
T: Clone,
Source§fn with_entity_generation_id(
self,
id: EntityGenerationId,
) -> WithEntityGenerationId<T>
fn with_entity_generation_id( self, id: EntityGenerationId, ) -> WithEntityGenerationId<T>
Convert a datastructure to a
WithEntityGenerationId
containing it.Source§impl<T> IntoWithEntityGenerationUuid<T> for Twhere
T: Clone,
impl<T> IntoWithEntityGenerationUuid<T> for Twhere
T: Clone,
Source§fn with_entity_generation_uuid(self, uuid: Uuid) -> WithEntityGenerationUuid<T>
fn with_entity_generation_uuid(self, uuid: Uuid) -> WithEntityGenerationUuid<T>
Convert a datastructure to a
WithEntityGenerationId
containing it.Source§impl<T, I> IntoWithNumericId<T, I> for Twhere
T: Clone,
I: NumericDatabseId,
impl<T, I> IntoWithNumericId<T, I> for Twhere
T: Clone,
I: NumericDatabseId,
Source§fn with_numeric_id(self, id: I) -> WithNumericId<T, I>
fn with_numeric_id(self, id: I) -> WithNumericId<T, I>
Convert a datastructure to a
WithNumericId
containing it.