pub struct Serializer<'a, T>where
    T: Target,
{ /* private fields */ }
Expand description

Implementations§

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.

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.

Remove any existing name/value pair.

Panics if called after .finish().

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

Serialize and append a name/value pair.

Panics if called after .finish().

Serialize and append a name of parameter without any value.

Panics if called after .finish().

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().

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().

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.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
TODO: once 1.33.0 is the minimum supported compiler version, remove Any::type_id_compat and use StdAny::type_id instead. https://github.com/rust-lang/rust/issues/27745
The archived version of the pointer metadata for this type.
Converts some archived metadata to the pointer metadata for itself.
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
Deserializes using the given deserializer

Returns the argument unchanged.

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
Attaches the current Context to this type, returning a WithContext wrapper. Read more
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
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 alignment of pointer.
The type for initializers.
Initializes a with the given initializer. Read more
Dereferences the given pointer. Read more
Mutably dereferences the given pointer. Read more
Drops the object pointed to by the given pointer. Read more
The type for metadata in pointers and references to Self.
Should always be Self
The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Checks if self is actually part of its subset T (and can be converted to it).
Use with care! Same as self.to_subset but without any property checks. Always succeeds.
The inclusion map: converts self to the equivalent element of its superset.
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
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