Struct Serializer

struct Serializer<'a, T: Target> { ... }

The application/x-www-form-urlencoded serializer.

Implementations

impl<'a, T: Target> Serializer<'a, T>

fn new(target: T) -> Self

Create a new application/x-www-form-urlencoded serializer for the given target.

If the target is non-empty, its content is assumed to already be in application/x-www-form-urlencoded syntax.

fn for_suffix(target: T, start_position: usize) -> Self

Create a new application/x-www-form-urlencoded serializer for a suffix of the given target.

If that suffix is non-empty, its content is assumed to already be in application/x-www-form-urlencoded syntax.

fn clear(self: &mut Self) -> &mut Self

Remove any existing name/value pair.

Panics if called after .finish().

fn encoding_override(self: &mut Self, new: EncodingOverride<'a>) -> &mut Self

Set the character encoding to be used for names and values before percent-encoding.

fn append_pair(self: &mut Self, name: &str, value: &str) -> &mut Self

Serialize and append a name/value pair.

Panics if called after .finish().

fn append_key_only(self: &mut Self, name: &str) -> &mut Self

Serialize and append a name of parameter without any value.

Panics if called after .finish().

fn extend_pairs<I, K, V>(self: &mut Self, iter: I) -> &mut Self
where
    I: IntoIterator,
    <I as >::Item: Borrow<(K, V)>,
    K: AsRef<str>,
    V: AsRef<str>

Serialize and append a number of name/value pairs.

This simply calls append_pair repeatedly. This can be more convenient, so the user doesn’t need to introduce a block to limit the scope of Serializer’s borrow of its string.

Panics if called after .finish().

fn extend_keys_only<I, K>(self: &mut Self, iter: I) -> &mut Self
where
    I: IntoIterator,
    <I as >::Item: Borrow<K>,
    K: AsRef<str>

Serialize and append a number of names without values.

This simply calls append_key_only repeatedly. This can be more convenient, so the user doesn’t need to introduce a block to limit the scope of Serializer’s borrow of its string.

Panics if called after .finish().

fn finish(self: &mut Self) -> <T as >::Finished

If this serializer was constructed with a string, take and return that string.

use form_urlencoded;
let encoded: String = form_urlencoded::Serializer::new(String::new())
    .append_pair("foo", "bar & baz")
    .append_pair("saison", "Été+hiver")
    .finish();
assert_eq!(encoded, "foo=bar+%26+baz&saison=%C3%89t%C3%A9%2Bhiver");

Panics if called more than once.

impl<'a, T> Freeze for Serializer<'a, T>

impl<'a, T> RefUnwindSafe for Serializer<'a, T>

impl<'a, T> Send for Serializer<'a, T>

impl<'a, T> Sync for Serializer<'a, T>

impl<'a, T> Unpin for Serializer<'a, T>

impl<'a, T> UnsafeUnpin for Serializer<'a, T>

impl<'a, T> UnwindSafe for Serializer<'a, T>

impl<T> Any for Serializer<'a, T>

fn type_id(self: &Self) -> TypeId

impl<T> Borrow for Serializer<'a, T>

fn borrow(self: &Self) -> &T

impl<T> BorrowMut for Serializer<'a, T>

fn borrow_mut(self: &mut Self) -> &mut T

impl<T> From for Serializer<'a, T>

fn from(t: T) -> T

Returns the argument unchanged.

impl<T, U> Into for Serializer<'a, T>

fn into(self: Self) -> U

Calls U::from(self).

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

impl<T, U> TryFrom for Serializer<'a, T>

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

impl<T, U> TryInto for Serializer<'a, T>

fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>