Struct AsciiDenyList

#[repr(transparent)]
pub struct AsciiDenyList { /* private fields */ }

The ASCII deny list to be applied.

Implementations

impl AsciiDenyList

const fn new(deny_glyphless: bool, deny_list: &str) -> Self

Computes (preferably at compile time) an ASCII deny list.

Setting deny_glyphless to true denies U+0020 SPACE and below as well as U+007F DELETE for convenience without having to list these characters in the deny_list string.

deny_list is the list of ASCII characters to deny. This list must not contain any of:

  • Letters
  • Digits
  • Hyphen
  • Dot (period / full-stop)
  • Non-ASCII

Panics

If the deny list contains characters listed as prohibited above.

const EMPTY: Self = _;

No ASCII deny list. This corresponds to UseSTD3ASCIIRules=false.

Equivalent to AsciiDenyList::new(false, "").

Note: Not denying the space and control characters can result in strange behavior. Without a deny list provided to the UTS 46 operation, the caller is expected perform filtering afterwards, but it's more efficient to use AsciiDenyList than post-processing, because the internals of this crate can optimize away checks in certain cases.

const STD3: Self = _;

The STD3 deny list. This corresponds to UseSTD3ASCIIRules=true.

Note that this deny list rejects the underscore, which occurs in pseudo-hosts used by various TXT record-based protocols, and also characters that may occurs in non-DNS naming, such as NetBIOS.

const URL: Self = _;

Forbidden domain code point from the WHATWG URL Standard.

Equivalent to AsciiDenyList::new(true, "%#/:<>?@[\\]^|").

Note that this deny list rejects IPv6 addresses, so (as in URL parsing) you need to check for IPv6 addresses first and not put them through UTS 46 processing.

Trait Implementations

impl Clone for AsciiDenyList

fn clone(&self) -> Self

impl Copy for AsciiDenyList

impl Eq for AsciiDenyList

impl PartialEq for AsciiDenyList

fn eq(&self, other: &Self) -> bool

impl StructuralPartialEq for AsciiDenyList

Auto Trait Implementations

impl Freeze for AsciiDenyList

impl RefUnwindSafe for AsciiDenyList

impl Send for AsciiDenyList

impl Sync for AsciiDenyList

impl Unpin for AsciiDenyList

impl UnsafeUnpin for AsciiDenyList

impl UnwindSafe for AsciiDenyList

Blanket Implementations

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

fn type_id(&self) -> TypeId

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

fn borrow(&self) -> &T

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

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

impl<T> CloneToUninit for AsciiDenyList where T: Clone,

unsafe fn clone_to_uninit(&self, dest: *mut u8)

impl<T> From<T> for AsciiDenyList

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> ToOwned for AsciiDenyList where T: Clone,

type Owned = T;
fn to_owned(&self) -> T
fn clone_into(&self, target: &mut T)

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

fn into(self) -> U

Calls U::from(self).

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

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

type Error = never;
fn try_from(value: U) -> Result<T, never>

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

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