ListProvider

Struct ListProvider 

Source
pub struct ListProvider<T: Table>(/* private fields */);
Expand description

ListProvider is a generic struct that provides results based on a standard eTLD list generated by the included Golang program. To override the list included with this crate, disable the default_provider crate feature and create a ListProvider with your own implmentation of the Table trait, generated from your own custom list.

Implementations§

Source§

impl<T: Table> ListProvider<T>

Source

pub const fn new() -> Self

Create a new ListProvider.

Source

pub fn public_suffix<'a>(&self, domain: &'a str) -> &'a str

Returns the public suffix of the domain using a copy of the publicsuffix.org database compiled into the library (if using the default_provider crate feature) or your own impl of Table.

Note: The input string must be punycode (ASCII) and the result will be punycode (ASCII). The implementation of this function assumes each character is encoded in one byte; this assumption is inherent in the design of the generated table.

It is recommended to use idna::domain_to_ascii to convert your inputs to ASCII punycode before passing to this method.

Source

pub fn is_effective_tld(&self, domain: &str) -> bool

Returns true if domain is an effective top level domain.

Trait Implementations§

Source§

impl<T: Table> Default for ListProvider<T>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<T: Table> EffectiveTLDProvider for ListProvider<T>

Source§

fn effective_tld_plus_one<'a>(&self, domain: &'a str) -> Result<&'a str, Error>

Returns the effective top level domain plus one more label. For example, the eTLD+1 for “foo.bar.golang.org” is “golang.org”. Read more

Auto Trait Implementations§

§

impl<T> Freeze for ListProvider<T>

§

impl<T> RefUnwindSafe for ListProvider<T>
where T: RefUnwindSafe,

§

impl<T> Send for ListProvider<T>
where T: Send,

§

impl<T> Sync for ListProvider<T>
where T: Sync,

§

impl<T> Unpin for ListProvider<T>
where T: Unpin,

§

impl<T> UnwindSafe for ListProvider<T>
where T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.