1# Function Overloads
2
3Many Web APIs are overloaded to take different types of arguments or to skip
4arguments completely. `web-sys` contains multiple bindings for these functions
5that each specialize to a particular overload and set of argument types.
6
7For example, [the `fetch` API][mdn-fetch] can be given a URL string, or a
8`Request` object, and it might also optionally be given a `RequestInit` options
9object. Therefore, we end up with these `web-sys` functions that all bind to the
10`window.fetch` function:
11
12* [`Window::fetch_with_str`](https://rustwasm.github.io/wasm-bindgen/api/web_sys/struct.Window.html#method.fetch_with_str)
13* [`Window::fetch_with_request`](https://rustwasm.github.io/wasm-bindgen/api/web_sys/struct.Window.html#method.fetch_with_request)
14* [`Window::fetch_with_str_and_init`](https://rustwasm.github.io/wasm-bindgen/api/web_sys/struct.Window.html#method.fetch_with_str_and_init)
15* [`Window::fetch_with_request_and_init`](https://rustwasm.github.io/wasm-bindgen/api/web_sys/struct.Window.html#method.fetch_with_request_and_init)
16
17Note that different overloads can use different interfaces, and therefore can
18require different sets of cargo features to be enabled.
19
20[mdn-fetch]: https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/fetch
21