ping-proto 0.0.1

Simple ASCII PING/PONG protocol implementation
Documentation
  • Coverage
  • 100%
    14 out of 14 items documented1 out of 9 items with examples
  • Size
  • Source code size: 29.7 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 444.99 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 14s Average build duration of successful builds.
  • all releases: 14s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • ringline-rs/ping-proto
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • brayniac

ping-proto

Simple ASCII PING/PONG protocol implementation.

Features

  • PING request encoding (PING\r\n)
  • PONG response parsing (both PONG\r\n and RESP-style +PONG\r\n)
  • Error response parsing (-ERR ...\r\n)

Usage

[dependencies]
ping-proto = "0.0.1"
use ping_proto::{Request, Response};

// Encode a PING request
let mut buf = [0u8; 16];
let len = Request::Ping.encode(&mut buf);
assert_eq!(&buf[..len], b"PING\r\n");

// Parse a PONG response
let data = b"PONG\r\n";
let (response, consumed) = Response::parse(data).unwrap();
assert_eq!(response, Response::Pong);

License

Licensed under either of Apache License, Version 2.0 or MIT License at your option.