Skip to main content

write_msg_id

Function write_msg_id 

Source
pub fn write_msg_id(
    left: &str,
    right: &str,
    out: &mut impl Sink,
) -> Result<(), WriteError>
Expand description

Writes <left@right>. left must be ASCII dot-atom-text; right the same or a domain literal in brackets.

§Errors

WriteError::Forbidden with at counting through left and then right (a byte outside the grammar, a misplaced dot, an empty side); WriteError::Full (nothing written when the sink reports its room).

§Examples

use parse_net::{mail, SliceSink};

let mut buf = [0u8; 64];
let mut out = SliceSink::new(&mut buf);
mail::write_msg_id("1234.5678", "mail.example.com", &mut out)?;
assert_eq!(out.written(), b"<1234.5678@mail.example.com>");