logo
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

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.

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

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

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

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more