XU XUv0.8.8
中文

API

#net/mail

import: #net/mail

counts: 2 fns, 1 methods, 1 types, 0 consts, 0 ifaces

Mailbox address parsing.

struct Address

XuAPI
pub struct Address {
    pub name string
    pub address string
}

Purpose

RFC 5322 address subset aligned with `net/mail` ParseAddress ParseAddressList. No CFWS folding, no groups (`Name: a, b;`), no RFC 2047 encoded-words. Name quoting is `"` with `\"`.

Parameters

name string
name
address string
field (string)

parse_address

XuAPI
pub fn parse_address(s &string) Address

Purpose

Parse as address. Throws on failure.

Parameters

s &string
source string (borrowed; caller keeps it; type &string)

Returns

Address — a value of this type

parse_address_list

XuAPI
pub fn parse_address_list(s &string) []Address

Purpose

Parse as address list. Throws on failure.

Parameters

s &string
source string (borrowed; caller keeps it; type &string)

Returns

[]Address — slice result

(Address) to_string

XuAPI
pub fn (a Address) to_string() string

Purpose

Method on `Address`: convert to string.

Parameters

a Address
receiver Address (value receiver)

Returns

string — result string