stdlib icon indicating copy to clipboard operation
stdlib copied to clipboard

Add primitives to set fields on `Uri` objects.

Open vxern opened this issue 8 months ago • 4 comments

Considering the signature of Uri, to make working with the type a little nicer, I would propose to add value setter primitives corresponding to fields on the Uri type:

pub type Uri {
  Uri(
    scheme: Option(String),
    userinfo: Option(String),
    host: Option(String),
    port: Option(Int),
    path: String,
    query: Option(String),
    fragment: Option(String),
  )
}

The primitives would have the following signatures:

  • set_scheme(uri: Uri, scheme: String) -> Uri
  • set_userinfo(uri: Uri, userinfo: String) -> Uri
  • set_host(uri: Uri, host: String) -> Uri
  • set_port(uri: Uri, port: Int) -> Uri
  • set_path(uri: Uri, path: String) -> Uri
  • set_query(uri: Uri, query: String) -> Uri
  • set_fragment(uri: Uri, fragment: String) -> Uri

If okay'd, I'd be happy to go ahead and implement these myself.

vxern avatar May 31 '24 21:05 vxern