Docs.rs
  • irc-rust-0.4.0
    • irc-rust 0.4.0
    • Permalink
    • Docs.rs crate page
    • MIT
    • Links
    • Homepage
    • Repository
    • crates.io
    • Source
    • Owners
    • MoBlaa
    • Dependencies
      • serde ^1.0.111 normal optional
      • rand ^0.7.3 dev
      • serde_json ^1.0.53 dev
    • Versions
    • 27.91% of the crate is documented
  • Platform
    • i686-pc-windows-msvc
    • i686-unknown-linux-gnu
    • x86_64-apple-darwin
    • x86_64-pc-windows-msvc
    • x86_64-unknown-linux-gnu
  • Feature flags
  • docs.rs
    • About docs.rs
    • Privacy policy
  • Rust
    • Rust website
    • The Book
    • Standard Library API Reference
    • Rust by Example
    • The Cargo Guide
    • Clippy Documentation

Crate irc_rust

irc_rust0.4.0

  • All Items

Sections

  • Support
  • Examples - for starters

Crate Items

  • Re-exports
  • Modules

Crates

  • irc_rust

Crate irc_rust

Source
Expand description

This crate implements a simple irc message wrapper.

This project has 2 goals:

  • Ease the access to fields of the message without requiring the user to handle offsets and other IRC related things.
  • Minimize memory foodprint. For this goal the Message struct only owns the String of the actual message. Any parts of the message and other structs only work on references of this string.

Therefore this project expects the strings passed to the struct constructors to be valid parts of the IRC standard.

As reference the RFC2812 and some extensions from IRCv3 are used.

§Support

Current support (as of version ‘0.3.*’):

  • Message: Create read-only Message from String or &str and with a builder Message::builder().
  • Tags: access through the indexing operator and iterating over all tags.
  • Prefix: Read-only access + Builder.
  • Parameters List: Read-only access, Iteration over elements, separate access to trailing parameter.
  • Serde: Serialization in any format supported by serde.

§Examples - for starters

Simple example with static string:

use irc_rust::Message;

let message = Message::from("@key1=value1;key2=value2 :name!user@host CMD param1 param2 :trailing");

assert_eq!(message.to_string(), "@key1=value1;key2=value2 :name!user@host CMD param1 param2 :trailing");

While reading from standard input the Message::from method has to be used.

use irc_rust::Message;
use std::io::{BufRead, stdin};

for line in stdin().lock().lines() {
    match line {
        Ok(line) => {
            let message = Message::from(line);
            println!("> Received command: {}", message.command()?);
        }
        Err(e) => {
            println!("got error; aborting: {}", e);
            break;
        }
    }
}

Re-exports§

pub use message::Message;

Modules§

builder
errors
message
parsed
prefix
tokenizer

Results

Settings
Help
    method
    irc_rust::message::Message::params
    Returns the params if any are present.
    method
    irc_rust::parsed::Parsed::params
    method
    irc_rust::tokenizer::Tokenizer::params
    struct field
    irc_rust::tokenizer::PartialCfg::params
    struct
    irc_rust::tokenizer::ParamsState
    struct
    irc_rust::tokenizer::IntoParamsIter
    method
    irc_rust::builder::Builder::param
    Add a param.
    method
    irc_rust::parsed::Parsed::param
    Returns a param with given original index. If the Parsed …
    method
    irc_rust::tokenizer::Tokenizer::parts
    Returns None if the prefix is badly formatted or no prefix …
No results :(
Try on DuckDuckGo?

Or try looking in one of these:
  • The Rust Reference for technical details about the language.
  • Rust By Example for expository code examples.
  • The Rust Book for introductions to language features and the language itself.
  • Docs.rs for documentation of crates released on crates.io.
No results :(
Try on DuckDuckGo?

Or try looking in one of these:
  • The Rust Reference for technical details about the language.
  • Rust By Example for expository code examples.
  • The Rust Book for introductions to language features and the language itself.
  • Docs.rs for documentation of crates released on crates.io.