Skip to main content

ToQueryParams

Trait ToQueryParams 

Source
pub trait ToQueryParams: Serialize {
    // Provided method
    fn query_params(&self, next_cursor: Option<&str>) -> String { ... }
}
Expand description

Trait for converting request types to URL query parameters.

This trait is automatically implemented for all types that implement Serialize. It uses serde_html_form to serialize the struct fields into a query string. Arrays are serialized as repeated keys (key=val1&key=val2).

Provided Methods§

Source

fn query_params(&self, next_cursor: Option<&str>) -> String

Converts the request to a URL query string.

Returns an empty string if no parameters are set, otherwise returns a string starting with ? followed by URL-encoded key-value pairs. Also uses an optional cursor as a parameter, if provided.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§