Crate const_irc_message_parser
source ·Expand description
Const IRC Message Parser
A crate that allows you to parse a slice of bytes into a whole IrcMsg or parse a
slice of bytes into the individual components that make up an IrcMsg. It also
allows you to extract whichever portion of the message you want.
This is a #![no_std] crate that does not require alloc and has no dependencies.
Motivation
I wanted to see how much of an IRC message parser can be written in a const context. Every public and private function is const. I was even able to make all the tests const functions even though it ends up being more verbose.
Usage
Ensure you have a single message as a slice of bytes from your network.
Feed that single slice into the parser without the trailing carriage return and line feed to create an IrcMsg.
Use the provided methods to extract the information desired for an IRC client, server or bot.
Modules
- Method for parsing and extracting a
Command. - Methods for parsing and extracting information from
Parameters. - Methods for parsing and extracting information from
Source. - Methods for parsing and extracting information from
Tags.
Structs
- A single IRC Message created from a slice of bytes.
Enums
- A wrapper containing either a string slice or a non-utf8 slice of bytes.
- The possible types of errors when parsing an
IrcMsg.