Skip to main content

ParseOptions

Struct ParseOptions 

Source
pub struct ParseOptions<'a> {
    pub namespaces: &'a [(&'a str, Ns)],
    pub attr_namespaces: &'a [(&'a str, AttrNs)],
    pub default: Option<Ns>,
}
Expand description

What a stylesheet’s @namespace rules would declare, for SelectorList::parse_with. The default declares nothing, as SelectorList::parse does.

Namespaces are named by Ns for elements and AttrNs for attributes, so only the ones the parser puts nodes in can be declared: HTML, SVG and MathML, and XLink, XML and XMLNS. A custom namespace URI has nothing to name it. Neither do Ns::Xml and AttrNs::Host, which stand for whatever namespace the host keeps for an XML node, so declaring either is an error.

Fields§

§namespaces: &'a [(&'a str, Ns)]

Prefixes and their namespaces: ("svg", Ns::Svg) makes svg|rect a rect in the SVG namespace. Prefixes compare exactly.

§attr_namespaces: &'a [(&'a str, AttrNs)]

Prefixes for attribute selectors: ("xlink", AttrNs::XLink) makes [xlink|href] SVG’s xlink:href. A prefix only in namespaces names an element namespace, which no attribute is in, so it matches nothing in an attribute selector.

§default: Option<Ns>

The @namespace without a prefix: type selectors and * without a prefix match only elements in it, and so does a compound with neither. Attribute selectors aren’t affected.

Trait Implementations§

Source§

impl<'a> Clone for ParseOptions<'a>

Source§

fn clone(&self) -> ParseOptions<'a>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> Copy for ParseOptions<'a>

Source§

impl<'a> Debug for ParseOptions<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<'a> Default for ParseOptions<'a>

Source§

fn default() -> ParseOptions<'a>

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

Auto Trait Implementations§

§

impl<'a> Forget for ParseOptions<'a>

§

impl<'a> Freeze for ParseOptions<'a>

§

impl<'a> Move for ParseOptions<'a>

§

impl<'a> RefUnwindSafe for ParseOptions<'a>

§

impl<'a> Send for ParseOptions<'a>

§

impl<'a> Sync for ParseOptions<'a>

§

impl<'a> Unpin for ParseOptions<'a>

§

impl<'a> UnsafeUnpin for ParseOptions<'a>

§

impl<'a> UnwindSafe for ParseOptions<'a>

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> CloneToUninit for T
where T: Clone,

Source§

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

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.