rusmes-proto
Core protocol types for the RusMES mail server. This crate defines the foundational data types used across all other RusMES crates. It has no I/O dependencies and is designed to be lightweight.
Modules
| Module | Description |
|---|---|
mail |
Mail envelope, MailId, MailState state machine, AttributeValue |
address |
MailAddress, Domain, Username with validation |
message |
MimeMessage, MessageBody (small/large), HeaderMap, MessageId |
error |
MailError enum and Result type alias |
Key Types
The central mail envelope wrapping a message with routing metadata:
- Envelope sender/recipients (separate from message headers)
- Processing state (
Root,Transport,LocalDelivery,Error,Ghost,Custom) - Attributes map for inter-mailet communication
- Remote client information (IP, hostname)
split()method for partial-recipient processing
MailAddress
Type-safe email address with validation:
- Local part (1-64 chars, no
@) - Domain (1-255 chars, lowercase normalized)
FromStrimplementation for parsing"user@example.com"
MimeMessage
Message representation with streaming support:
MessageBody::Small(Bytes)for messages <1MBMessageBody::Large(...)placeholder for streaming large messagesHeaderMapfor message headers
Dependencies
serde- serializationuuid- unique IDsbytes- efficient byte buffersthiserror- error types
Usage
use ;
use Bytes;
let sender: MailAddress = "sender@example.com".parse.unwrap;
let recipient: MailAddress = "recipient@example.com".parse.unwrap;
let message = new;
let mail = new;
assert_eq!;
Tests