Skip to main content

EncodeOptions

Struct EncodeOptions 

Source
pub struct EncodeOptions { /* private fields */ }
Expand description

Options that control query-string encoding.

The defaults follow the common qs behavior: RFC 3986 percent-encoding, & delimiters, indexed list notation, and insertion-order output.

Implementations§

Source§

impl EncodeOptions

Source

pub fn new() -> Self

Creates a new option set with the default encode configuration.

Source

pub fn encode(&self) -> bool

Returns whether scalar values are percent-encoded.

Source

pub fn with_encode(self, encode: bool) -> Self

Enables or disables percent-encoding.

Source

pub fn delimiter(&self) -> &str

Returns the delimiter inserted between encoded pairs.

Source

pub fn with_delimiter<S>(self, delimiter: S) -> Self
where S: Into<String>,

Sets the delimiter inserted between encoded pairs.

Source

pub fn list_format(&self) -> ListFormat

Returns the list notation used for arrays.

Source

pub fn with_list_format(self, list_format: ListFormat) -> Self

Sets the list notation used for arrays.

Source

pub fn format(&self) -> Format

Returns the percent-encoding flavor used for strings.

Source

pub fn with_format(self, format: Format) -> Self

Sets the percent-encoding flavor used for strings.

Source

pub fn charset(&self) -> Charset

Returns the character set used for percent-encoding.

Source

pub fn with_charset(self, charset: Charset) -> Self

Sets the character set used for percent-encoding.

Source

pub fn charset_sentinel(&self) -> bool

Returns whether a charset sentinel is prefixed to the output.

Source

pub fn with_charset_sentinel(self, charset_sentinel: bool) -> Self

Enables or disables prepending a charset sentinel pair.

Source

pub fn allow_empty_lists(&self) -> bool

Returns whether empty arrays are emitted.

Source

pub fn with_allow_empty_lists(self, allow_empty_lists: bool) -> Self

Enables or disables emitting empty arrays.

Source

pub fn strict_null_handling(&self) -> bool

Returns whether nulls are emitted without =.

Source

pub fn with_strict_null_handling(self, strict_null_handling: bool) -> Self

Enables or disables strict null handling.

Source

pub fn skip_nulls(&self) -> bool

Returns whether null values are omitted entirely.

Source

pub fn with_skip_nulls(self, skip_nulls: bool) -> Self

Enables or disables omission of null values.

Source

pub fn comma_round_trip(&self) -> bool

Returns whether single-item comma lists are round-tripped with [].

Source

pub fn with_comma_round_trip(self, comma_round_trip: bool) -> Self

Enables or disables comma round-tripping for single-item arrays.

Source

pub fn comma_compact_nulls(&self) -> bool

Returns whether nulls are compacted out of comma-encoded arrays.

Source

pub fn with_comma_compact_nulls(self, comma_compact_nulls: bool) -> Self

Enables or disables null compaction for comma-encoded arrays.

Source

pub fn encode_values_only(&self) -> bool

Returns whether only values, and not keys, are percent-encoded.

Source

pub fn with_encode_values_only(self, encode_values_only: bool) -> Self

Enables or disables value-only percent-encoding.

Source

pub fn add_query_prefix(&self) -> bool

Returns whether a leading ? is prefixed to the output.

Source

pub fn with_add_query_prefix(self, add_query_prefix: bool) -> Self

Enables or disables a leading ? in the encoded output.

Source

pub fn allow_dots(&self) -> bool

Returns whether nested object paths are encoded with dot notation.

Source

pub fn with_allow_dots(self, allow_dots: bool) -> Self

Enables or disables dot notation during encode.

Setting this to false also clears Self::encode_dot_in_keys.

Source

pub fn encode_dot_in_keys(&self) -> bool

Returns whether literal dots in key names are percent-encoded when dot notation is active.

Source

pub fn with_encode_dot_in_keys(self, encode_dot_in_keys: bool) -> Self

Enables or disables percent-encoding of literal dots in keys.

Enabling this option also enables Self::allow_dots.

Source

pub fn filter(&self) -> Option<&EncodeFilter>

Returns the configured filter, if any.

Source

pub fn with_filter(self, filter: Option<EncodeFilter>) -> Self

Sets an optional encode filter.

Source

pub fn whitelist(&self) -> Option<&[WhitelistSelector]>

Returns the current whitelist when EncodeFilter::Whitelist is in use.

Source

pub fn with_whitelist(self, whitelist: Option<Vec<WhitelistSelector>>) -> Self

Replaces the current filter with a whitelist, or clears it when None is supplied.

Source

pub fn sort(&self) -> SortMode

Returns the built-in sort mode.

Source

pub fn with_sort(self, sort: SortMode) -> Self

Sets the built-in sort mode.

Source

pub fn sorter(&self) -> Option<&Sorter>

Returns the custom sorter, if one is configured.

Source

pub fn with_sorter(self, sorter: Option<Sorter>) -> Self

Sets an optional custom sorter.

Source

pub fn encoder(&self) -> Option<&EncodeTokenEncoder>

Returns the custom key/value encoder, if one is configured.

Source

pub fn with_encoder(self, encoder: Option<EncodeTokenEncoder>) -> Self

Sets an optional custom key/value encoder.

Source

pub fn temporal_serializer(&self) -> Option<&TemporalSerializer>

Returns the custom temporal serializer, if one is configured.

Source

pub fn with_temporal_serializer( self, temporal_serializer: Option<TemporalSerializer>, ) -> Self

Sets an optional custom temporal serializer.

Source

pub fn max_depth(&self) -> Option<usize>

Returns the maximum traversal depth, if one is configured.

Source

pub fn with_max_depth(self, max_depth: Option<usize>) -> Self

Sets the maximum traversal depth.

Trait Implementations§

Source§

impl Clone for EncodeOptions

Source§

fn clone(&self) -> EncodeOptions

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for EncodeOptions

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for EncodeOptions

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.