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
impl EncodeOptions
Sourcepub fn with_encode(self, encode: bool) -> Self
pub fn with_encode(self, encode: bool) -> Self
Enables or disables percent-encoding.
Sourcepub fn with_delimiter<S>(self, delimiter: S) -> Self
pub fn with_delimiter<S>(self, delimiter: S) -> Self
Sets the delimiter inserted between encoded pairs.
Sourcepub fn list_format(&self) -> ListFormat
pub fn list_format(&self) -> ListFormat
Returns the list notation used for arrays.
Sourcepub fn with_list_format(self, list_format: ListFormat) -> Self
pub fn with_list_format(self, list_format: ListFormat) -> Self
Sets the list notation used for arrays.
Sourcepub fn with_format(self, format: Format) -> Self
pub fn with_format(self, format: Format) -> Self
Sets the percent-encoding flavor used for strings.
Sourcepub fn with_charset(self, charset: Charset) -> Self
pub fn with_charset(self, charset: Charset) -> Self
Sets the character set used for percent-encoding.
Sourcepub fn charset_sentinel(&self) -> bool
pub fn charset_sentinel(&self) -> bool
Returns whether a charset sentinel is prefixed to the output.
Sourcepub fn with_charset_sentinel(self, charset_sentinel: bool) -> Self
pub fn with_charset_sentinel(self, charset_sentinel: bool) -> Self
Enables or disables prepending a charset sentinel pair.
Sourcepub fn allow_empty_lists(&self) -> bool
pub fn allow_empty_lists(&self) -> bool
Returns whether empty arrays are emitted.
Sourcepub fn with_allow_empty_lists(self, allow_empty_lists: bool) -> Self
pub fn with_allow_empty_lists(self, allow_empty_lists: bool) -> Self
Enables or disables emitting empty arrays.
Sourcepub fn strict_null_handling(&self) -> bool
pub fn strict_null_handling(&self) -> bool
Returns whether nulls are emitted without =.
Sourcepub fn with_strict_null_handling(self, strict_null_handling: bool) -> Self
pub fn with_strict_null_handling(self, strict_null_handling: bool) -> Self
Enables or disables strict null handling.
Sourcepub fn skip_nulls(&self) -> bool
pub fn skip_nulls(&self) -> bool
Returns whether null values are omitted entirely.
Sourcepub fn with_skip_nulls(self, skip_nulls: bool) -> Self
pub fn with_skip_nulls(self, skip_nulls: bool) -> Self
Enables or disables omission of null values.
Sourcepub fn comma_round_trip(&self) -> bool
pub fn comma_round_trip(&self) -> bool
Returns whether single-item comma lists are round-tripped with [].
Sourcepub fn with_comma_round_trip(self, comma_round_trip: bool) -> Self
pub fn with_comma_round_trip(self, comma_round_trip: bool) -> Self
Enables or disables comma round-tripping for single-item arrays.
Sourcepub fn comma_compact_nulls(&self) -> bool
pub fn comma_compact_nulls(&self) -> bool
Returns whether nulls are compacted out of comma-encoded arrays.
Sourcepub fn with_comma_compact_nulls(self, comma_compact_nulls: bool) -> Self
pub fn with_comma_compact_nulls(self, comma_compact_nulls: bool) -> Self
Enables or disables null compaction for comma-encoded arrays.
Sourcepub fn encode_values_only(&self) -> bool
pub fn encode_values_only(&self) -> bool
Returns whether only values, and not keys, are percent-encoded.
Sourcepub fn with_encode_values_only(self, encode_values_only: bool) -> Self
pub fn with_encode_values_only(self, encode_values_only: bool) -> Self
Enables or disables value-only percent-encoding.
Sourcepub fn add_query_prefix(&self) -> bool
pub fn add_query_prefix(&self) -> bool
Returns whether a leading ? is prefixed to the output.
Sourcepub fn with_add_query_prefix(self, add_query_prefix: bool) -> Self
pub fn with_add_query_prefix(self, add_query_prefix: bool) -> Self
Enables or disables a leading ? in the encoded output.
Sourcepub fn allow_dots(&self) -> bool
pub fn allow_dots(&self) -> bool
Returns whether nested object paths are encoded with dot notation.
Sourcepub fn with_allow_dots(self, allow_dots: bool) -> Self
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.
Sourcepub fn encode_dot_in_keys(&self) -> bool
pub fn encode_dot_in_keys(&self) -> bool
Returns whether literal dots in key names are percent-encoded when dot notation is active.
Sourcepub fn with_encode_dot_in_keys(self, encode_dot_in_keys: bool) -> Self
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.
Sourcepub fn filter(&self) -> Option<&EncodeFilter>
pub fn filter(&self) -> Option<&EncodeFilter>
Returns the configured filter, if any.
Sourcepub fn with_filter(self, filter: Option<EncodeFilter>) -> Self
pub fn with_filter(self, filter: Option<EncodeFilter>) -> Self
Sets an optional encode filter.
Sourcepub fn whitelist(&self) -> Option<&[WhitelistSelector]>
pub fn whitelist(&self) -> Option<&[WhitelistSelector]>
Returns the current whitelist when EncodeFilter::Whitelist is in
use.
Sourcepub fn with_whitelist(self, whitelist: Option<Vec<WhitelistSelector>>) -> Self
pub fn with_whitelist(self, whitelist: Option<Vec<WhitelistSelector>>) -> Self
Replaces the current filter with a whitelist, or clears it when None
is supplied.
Sourcepub fn with_sorter(self, sorter: Option<Sorter>) -> Self
pub fn with_sorter(self, sorter: Option<Sorter>) -> Self
Sets an optional custom sorter.
Sourcepub fn encoder(&self) -> Option<&EncodeTokenEncoder>
pub fn encoder(&self) -> Option<&EncodeTokenEncoder>
Returns the custom key/value encoder, if one is configured.
Sourcepub fn with_encoder(self, encoder: Option<EncodeTokenEncoder>) -> Self
pub fn with_encoder(self, encoder: Option<EncodeTokenEncoder>) -> Self
Sets an optional custom key/value encoder.
Sourcepub fn temporal_serializer(&self) -> Option<&TemporalSerializer>
pub fn temporal_serializer(&self) -> Option<&TemporalSerializer>
Returns the custom temporal serializer, if one is configured.
Sourcepub fn with_temporal_serializer(
self,
temporal_serializer: Option<TemporalSerializer>,
) -> Self
pub fn with_temporal_serializer( self, temporal_serializer: Option<TemporalSerializer>, ) -> Self
Sets an optional custom temporal serializer.
Sourcepub fn max_depth(&self) -> Option<usize>
pub fn max_depth(&self) -> Option<usize>
Returns the maximum traversal depth, if one is configured.
Sourcepub fn with_max_depth(self, max_depth: Option<usize>) -> Self
pub fn with_max_depth(self, max_depth: Option<usize>) -> Self
Sets the maximum traversal depth.
Trait Implementations§
Source§impl Clone for EncodeOptions
impl Clone for EncodeOptions
Source§fn clone(&self) -> EncodeOptions
fn clone(&self) -> EncodeOptions
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more