TyOverby / irc-message

An IRC message parser for Rust.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Tag value should be Option<T>

Kilobyte22 opened this issue · comments

Currently you represent the value of a tag as string. This does not work well for value-less options. An idea would be to replace that T with Option<T> and set it to Some(value) for keys with value and to None for those without.

Your example output from the readme would then look like this:

Ok(
  IrcMessage {
    tags: {
      best: Some(super),
      single: None
    },
    prefix: Some(test!me@test.ing),
    command: Some(FOO),
    params: [bar, baz, quux, This is a test]
  }
)

I would not mind implementing this myself and submitting a pull request. However i want to put this up for discussion first.

I am very well aware that this would be a breaking change, however it is almost unevitable, in case you want to ever properly support tags which have the actual value true. Apart from that it fits better in rusts type system

I like it!

If you are interested in writing the PR, I'll take it!