pub struct FormUrlencodedCodec;Expand description
Encodes and decodes application/x-www-form-urlencoded text fragments.
Its low-level Codec<Value = u8, Unit = u8> implementation converts one
byte at a time, including the form-specific space and + mapping. UTF-8
validation remains part of the owned decode helper.
Implementations§
Source§impl FormUrlencodedCodec
impl FormUrlencodedCodec
Sourcepub fn decode(&self, text: &str) -> MiscCodecResult<String>
pub fn decode(&self, text: &str) -> MiscCodecResult<String>
Decodes text, treating + as space.
§Parameters
text: Text to decode.
§Returns
Decoded UTF-8 text.
§Errors
Returns MiscCodecError when an escape is malformed or decoded bytes
are not valid UTF-8.
Trait Implementations§
Source§impl Clone for FormUrlencodedCodec
impl Clone for FormUrlencodedCodec
Source§fn clone(&self) -> FormUrlencodedCodec
fn clone(&self) -> FormUrlencodedCodec
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Codec for FormUrlencodedCodec
impl Codec for FormUrlencodedCodec
Source§fn min_units_per_value(&self) -> NonZeroUsize
fn min_units_per_value(&self) -> NonZeroUsize
Returns the shortest representation length for one byte.
Source§fn max_units_per_value(&self) -> NonZeroUsize
fn max_units_per_value(&self) -> NonZeroUsize
Returns the longest %XX representation length for one byte.
Source§unsafe fn decode_unchecked(
&self,
input: &[u8],
index: usize,
) -> Result<(u8, NonZeroUsize), Self::DecodeError>
unsafe fn decode_unchecked( &self, input: &[u8], index: usize, ) -> Result<(u8, NonZeroUsize), Self::DecodeError>
Decodes one raw byte, +, or %XX escape.
Source§unsafe fn encode_unchecked(
&self,
value: &u8,
output: &mut [u8],
index: usize,
) -> Result<usize, Self::EncodeError>
unsafe fn encode_unchecked( &self, value: &u8, output: &mut [u8], index: usize, ) -> Result<usize, Self::EncodeError>
Encodes one byte using form URL encoding.
Source§type DecodeError = MiscCodecError
type DecodeError = MiscCodecError
Error reported when decoding malformed units.
Source§type EncodeError = MiscCodecError
type EncodeError = MiscCodecError
Error reported when encoding an unsupported value.
impl Copy for FormUrlencodedCodec
Source§impl Debug for FormUrlencodedCodec
impl Debug for FormUrlencodedCodec
Source§impl Default for FormUrlencodedCodec
impl Default for FormUrlencodedCodec
Source§fn default() -> FormUrlencodedCodec
fn default() -> FormUrlencodedCodec
Returns the “default value” for a type. Read more
impl Eq for FormUrlencodedCodec
Source§impl PartialEq for FormUrlencodedCodec
impl PartialEq for FormUrlencodedCodec
Source§fn eq(&self, other: &FormUrlencodedCodec) -> bool
fn eq(&self, other: &FormUrlencodedCodec) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for FormUrlencodedCodec
Source§impl ValueDecoder<str> for FormUrlencodedCodec
impl ValueDecoder<str> for FormUrlencodedCodec
Auto Trait Implementations§
impl Freeze for FormUrlencodedCodec
impl RefUnwindSafe for FormUrlencodedCodec
impl Send for FormUrlencodedCodec
impl Sync for FormUrlencodedCodec
impl Unpin for FormUrlencodedCodec
impl UnsafeUnpin for FormUrlencodedCodec
impl UnwindSafe for FormUrlencodedCodec
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more