Struct Serializer
pub struct Serializer<'a, T: Target> { /* private fields */ }
Implementations
impl<'a, T: Target> Serializer<'a, T>
fn new(target: T) -> SelfCreate a new
application/x-www-form-urlencodedserializer for the given target.If the target is non-empty, its content is assumed to already be in
application/x-www-form-urlencodedsyntax.fn for_suffix(target: T, start_position: usize) -> SelfCreate a new
application/x-www-form-urlencodedserializer 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-urlencodedsyntax.fn clear(&mut self) -> &mut SelfRemove any existing name/value pair.
Panics if called after
.finish().fn encoding_override(&mut self, new: EncodingOverride<'a>) -> &mut SelfSet the character encoding to be used for names and values before percent-encoding.
fn append_pair(&mut self, name: &str, value: &str) -> &mut SelfSerialize and append a name/value pair.
Panics if called after
.finish().fn append_key_only(&mut self, name: &str) -> &mut SelfSerialize and append a name of parameter without any value.
Panics if called after
.finish().fn extend_pairs<I, K, V>(&mut self, iter: I) -> &mut Self where I: IntoIterator, I::Item: Borrow<(K, V)>, K: AsRef<str>, V: AsRef<str>,Serialize and append a number of name/value pairs.
This simply calls
append_pairrepeatedly. This can be more convenient, so the user doesn’t need to introduce a block to limit the scope ofSerializer’s borrow of its string.Panics if called after
.finish().fn extend_keys_only<I, K>(&mut self, iter: I) -> &mut Self where I: IntoIterator, I::Item: Borrow<K>, K: AsRef<str>,Serialize and append a number of names without values.
This simply calls
append_key_onlyrepeatedly. This can be more convenient, so the user doesn’t need to introduce a block to limit the scope ofSerializer’s borrow of its string.Panics if called after
.finish().fn finish(&mut self) -> T::FinishedIf this serializer was constructed with a string, take and return that string.
use form_urlencoded; let encoded: String = new .append_pair .append_pair .finish; assert_eq!;Panics if called more than once.
Auto Trait Implementations
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> !UnwindSafe for Serializer<'a, T>
impl<'a, T> Freeze for Serializer<'a, T>
where
Option<T>: Freeze,
impl<'a, T> Unpin for Serializer<'a, T>
where
Option<T>: Unpin,
impl<'a, T> UnsafeUnpin for Serializer<'a, T>
where
Option<T>: UnsafeUnpin,
Blanket Implementations
impl<T> Any for Serializer<'a, T>
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for Serializer<'a, T>
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for Serializer<'a, T>
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> From<T> for Serializer<'a, T>
fn from(t: T) -> TReturns the argument unchanged.
impl<T, U> Into<U> for Serializer<'a, T>
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for Serializer<'a, T>
where
U: Into<T>,
type Error = never;fn try_from(value: U) -> Result<T, never>
impl<T, U> TryInto<U> for Serializer<'a, T>
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>