Struct actix_router::Quoter

source ·
pub struct Quoter { /* private fields */ }
Expand description

Partial percent-decoding.

Performs percent-decoding on a slice but can selectively skip decoding certain sequences.

§Examples

// + is set as a protected character and will not be decoded...
let q = Quoter::new(&[], b"+");

// ...but the other encoded characters (like the hyphen below) will.
assert_eq!(q.requote(b"/a%2Db%2Bc").unwrap(), b"/a-b%2Bc");

Implementations§

source§

impl Quoter

source

pub fn new(_: &[u8], protected: &[u8]) -> Quoter

Constructs a new Quoter instance given a set of protected ASCII bytes.

The first argument is ignored but is kept for backward compatibility.

§Panics

Panics if any of the protected bytes are not in the 0-127 ASCII range.

source

pub fn requote(&self, val: &[u8]) -> Option<Vec<u8>>

Partially percent-decodes the given bytes.

Escape sequences of the protected set are not decoded.

Returns None when no modification to the original bytes was required.

Invalid/incomplete percent-encoding sequences are passed unmodified.

Auto Trait Implementations§

§

impl Freeze for Quoter

§

impl RefUnwindSafe for Quoter

§

impl Send for Quoter

§

impl Sync for Quoter

§

impl Unpin for Quoter

§

impl UnwindSafe for Quoter

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.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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>,

§

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>,

§

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.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more