[][src]Struct viaspf::record::Macro

pub struct Macro { /* fields omitted */ }

A macro.

Examples

use std::num::NonZeroU8;
use viaspf::record::*;

let mut m = Macro::new(MacroKind::Domain);
assert_eq!(m.to_string(), "%{d}");

m.set_url_encode(true);
m.set_limit(NonZeroU8::new(3).unwrap());
m.set_reverse(true);
m.set_delimiters(Delimiters::new(".+").unwrap());
assert_eq!(m.to_string(), "%{D3r.+}");

Implementations

impl Macro[src]

pub fn new(kind: MacroKind) -> Macro[src]

Creates a new macro of the given kind.

pub fn kind(&self) -> MacroKind[src]

Returns the macro kind.

pub fn set_kind(&mut self, value: MacroKind)[src]

Configures the macro’s kind.

pub fn url_encode(&self) -> bool[src]

Returns whether the macro should undergo URL encoding.

pub fn set_url_encode(&mut self, value: bool)[src]

Configures whether the macro should undergo URL encoding.

pub fn limit(&self) -> Option<NonZeroU8>[src]

Returns the macro’s size limit transformer.

pub fn set_limit<L>(&mut self, value: L) where
    L: Into<Option<NonZeroU8>>, 
[src]

Configures the macro’s size limit transformer.

pub fn reverse(&self) -> bool[src]

Returns the macro’s reverse transformer.

pub fn set_reverse(&mut self, value: bool)[src]

Configures the macro’s reverse transformer.

pub fn delimiters(&self) -> Option<&Delimiters>[src]

Returns the macro’s delimiters.

pub fn set_delimiters<D>(&mut self, value: D) where
    D: Into<Option<Delimiters>>, 
[src]

Configures the macro’s delimiters.

Trait Implementations

impl Clone for Macro[src]

impl Debug for Macro[src]

impl Display for Macro[src]

impl Eq for Macro[src]

impl From<Macro> for MacroExpand[src]

impl From<MacroKind> for Macro[src]

impl Hash for Macro[src]

impl PartialEq<Macro> for Macro[src]

impl StructuralEq for Macro[src]

impl StructuralPartialEq for Macro[src]

Auto Trait Implementations

impl RefUnwindSafe for Macro

impl Send for Macro

impl Sync for Macro

impl Unpin for Macro

impl UnwindSafe for Macro

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.