forked from lavina/lavina
1
0
Fork 0
lavina/src/protos/irc/mod.rs

29 lines
560 B
Rust
Raw Normal View History

2023-02-07 15:21:00 +00:00
//! Client-to-Server IRC protocol.
pub mod client;
pub mod server;
2023-02-07 15:21:00 +00:00
use std::io::Write;
use nom::{
branch::alt,
bytes::complete::{tag, take, take_while},
IResult,
};
type ByteVec = Vec<u8>;
/// Single message tag value.
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct Tag {
key: ByteVec,
value: Option<u8>,
}
fn receiver(input: &[u8]) -> IResult<&[u8], &[u8]> {
take_while(|i| i != b'\n' && i != b'\r' && i != b' ')(input)
}
fn token(input: &[u8]) -> IResult<&[u8], &[u8]> {
take_while(|i| i != b'\n' && i != b'\r')(input)
}