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. The only exceptions are the Display impls as functions on Traits are not yet allowed to be const (click here for details). I am also unaware of how to test Display impls in a const manner for code coverage. Suggestions welcome.

§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§

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.