#message-parser #irc #parser #no-alloc #irc-client #networking #no-std

no-std const_irc_message_parser

A 0 dependency, no_std, const-only parser for the IRC message protocol

9 releases (breaking)

0.7.1 Mar 12, 2024
0.7.0 Mar 12, 2024
0.6.0 Oct 29, 2023
0.5.0 Sep 9, 2023
0.1.1 Aug 21, 2023

#961 in Parser implementations

Download history 6/week @ 2024-02-20 4/week @ 2024-02-27 265/week @ 2024-03-12 8/week @ 2024-03-19 1/week @ 2024-03-26 45/week @ 2024-04-02

319 downloads per month

ISC license

125KB
2K SLoC

const_irc_message_parser

A 0 dependency, no_std, const-only parser for the IRC message protocol.

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 (https://github.com/rust-lang/rust/issues/103265). I am also unaware of how to test Display impls in a const manner for code coverage. Suggestions welcome.

Documentation

Documentation can be found here: https://docs.rs/const_irc_message_parser

Acknowledgements


lib.rs:

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.

No runtime deps