gossamer/url_search_params

Types

URLSearchParams provides methods for working with the query string of a URL.

pub type URLSearchParams

Values

pub fn append(
  params: URLSearchParams,
  name: String,
  value: String,
) -> URLSearchParams

Appends a specified key/value pair as a new search parameter.

pub fn delete(
  params: URLSearchParams,
  name: String,
) -> URLSearchParams

Deletes search parameters that match a name from the list of all search parameters.

pub fn delete_value(
  params: URLSearchParams,
  name: String,
  value: String,
) -> URLSearchParams

Deletes search parameters that match a name and value from the list of all search parameters.

pub fn entries(
  params: URLSearchParams,
) -> List(#(String, String))

Returns a list of all key/value pairs contained in this object.

pub fn for_each(
  params: URLSearchParams,
  callback: fn(String, String) -> Nil,
) -> Nil

Calls a function for each element contained in this object in place.

pub fn from_pairs(
  pairs: List(#(String, String)),
) -> URLSearchParams
pub fn from_string(query: String) -> URLSearchParams
pub fn get(
  params: URLSearchParams,
  name: String,
) -> option.Option(String)

Returns the first value associated to the given search parameter.

pub fn get_all(
  params: URLSearchParams,
  name: String,
) -> List(String)

Returns all the values associated with a given search parameter as a list.

pub fn has(params: URLSearchParams, name: String) -> Bool

Returns a boolean value indicating if a given parameter exists.

pub fn has_value(
  params: URLSearchParams,
  name: String,
  value: String,
) -> Bool

Returns a boolean value indicating if a given parameter and value pair exists.

pub fn keys(params: URLSearchParams) -> List(String)

Returns a list of all keys contained in this object.

pub fn set(
  params: URLSearchParams,
  name: String,
  value: String,
) -> URLSearchParams

Sets the value associated with a given search parameter to the given value. If there were several matching values, this method deletes the others. If the search parameter doesn’t exist, this method creates it.

pub fn size(params: URLSearchParams) -> Int

Contains the number of search parameters.

pub fn sort(params: URLSearchParams) -> URLSearchParams

Sort all key/value pairs contained in this object in place. The sort order is according to Unicode code points of the keys.

pub fn to_string(params: URLSearchParams) -> String

Returns a query string suitable for use in a URL.

pub fn values(params: URLSearchParams) -> List(String)

Returns a list of all values contained in this object.

Search Document