---@meta

---The `Url` object represents a parsed URL.
---
---An example:
---
---```lua
---local wezterm = require 'wezterm'
---
---local url = wezterm.url.parse 'file://myhost/some/path%20with%20spaces'
---assert(url.scheme == 'file')
---assert(url.file_path == '/some/path with spaces')
---
---local url =
---  wezterm.url.parse 'https://github.com/rust-lang/rust/issues?labels=E-easy&state=open'
---assert(url.scheme == 'https')
---assert(url.username == '')
---assert(url.password == nil)
---assert(url.host == 'github.com')
---assert(url.path == '/rust-lang/rust/issues')
---assert(url.query == 'labels=E-easy&state=open')
---```
---
---@class Url
---The URL scheme such as `"file"`, or `"https"`.
---
---@field scheme? string|"file"|"https"|"http"
---Decodes the path field and interprets it as a file path.
---
---@field file_path? string
---The `username` portion of the URL, or an empty string
---if none is specified.
---
---@field username string|""
---The password portion of the URL, or `nil` if none is specified.
---
---@field password? string|nil
---The `hostname` portion of the URL, with IDNA decoded to UTF-8.
---
---@field host? string
---The `path` portion of the URL, complete with percent encoding.
---
---@field path? string
---The `fragment` portion of the URL.
---
---@field fragment? string
---The `query` portion of the URL.
---
---@field query? string

---The `wezterm.url` module exposes functions that
---allow working with URLs.
---
---@class Wezterm.Url
---The `Url` object represents a parsed URL.
---
---@field Url Url
local M = {}

---Attempts to parse the provided URL_STRING as a URL.
---
---If successful, returns a `Url` object representing said URL.
---
---@param url_string string
---@return Url?
function M.parse(url_string) end
