XU XUv0.16.0

#net/textproto

import: #net/textproto

counts: 6 functions, 7 methods, 3 types, 0 constants, 0 method sets

MIME header canonicalization and parse.

struct MIMEHeader

XuAPI
pub struct MIMEHeader {
    pub keys []string
    pub vals []string
}

Purpose

Textproto Metadata header descriptor structure.

Public fields

keys []string
field ([]string)
vals []string
field ([]string)

struct HeaderRead

XuAPI
pub struct HeaderRead {
    pub header MIMEHeader
    pub rest string
}

Purpose

Structure encapsulating header, rest.

Public fields

header MIMEHeader
field (MIMEHeader)
rest string
field (string)

struct CodeLine

XuAPI
pub struct CodeLine {
    pub code int
    pub msg string
    pub cont bool
}

Purpose

Structure encapsulating code, msg, cont.

Public fields

code int
code
msg string
message
cont bool
field (bool)

canonical_mime_header_key

XuAPI
pub fn canonical_mime_header_key(s &string) string

Purpose

Canonical mime header key.

Parameters

s &string
source string (read-only borrow; caller keeps the original; type &string)

Returns

string — result string

trim_string

XuAPI
pub fn trim_string(s &string) string

Purpose

Trim string.

Parameters

s &string
source string (read-only borrow; caller keeps the original; type &string)

Returns

string — result string

new_header

XuAPI
pub fn new_header() MIMEHeader

Purpose

Construct header.

Parameters

No arguments are required.

Returns

MIMEHeader — a value of this type

(MIMEHeader) get

XuAPI
pub fn (h MIMEHeader) get(key &string) string

Purpose

Execute get on MIMEHeader.

Parameters

h MIMEHeader
The MIMEHeader instance used by this call (value receiver).
key &string
key (read-only borrow; caller keeps the original; type &string)

Returns

string — result string

(MIMEHeader) values

XuAPI
pub fn (h MIMEHeader) values(key &string) []string

Purpose

Return a slice containing all values in the collection.

Parameters

h MIMEHeader
The MIMEHeader instance used by this call (value receiver).
key &string
key (read-only borrow; caller keeps the original; type &string)

Returns

[]string — slice result

($&MIMEHeader) add

XuAPI
pub fn (h $&MIMEHeader) add(key &string, value &string)

Purpose

Operation on $&MIMEHeader: add.

Parameters

h $&MIMEHeader
The MIMEHeader instance used by this call (exclusive borrow).
key &string
key (read-only borrow; caller keeps the original; type &string)
value &string
value (read-only borrow; caller keeps the original; type &string)

Returns

This call does not return a value.

($&MIMEHeader) del

XuAPI
pub fn (h $&MIMEHeader) del(key &string)

Purpose

Delete the entry matching the given key or identifier.

Parameters

h $&MIMEHeader
The MIMEHeader instance used by this call (exclusive borrow).
key &string
key (read-only borrow; caller keeps the original; type &string)

Returns

This call does not return a value.

($&MIMEHeader) set

XuAPI
pub fn (h $&MIMEHeader) set(key &string, value &string)

Purpose

Execute set on $&MIMEHeader.

Parameters

h $&MIMEHeader
The MIMEHeader instance used by this call (exclusive borrow).
key &string
key (read-only borrow; caller keeps the original; type &string)
value &string
value (read-only borrow; caller keeps the original; type &string)

Returns

This call does not return a value.

(MIMEHeader) len

XuAPI
pub fn (h MIMEHeader) len() int

Purpose

Operation on MIMEHeader: return the length.

Parameters

h MIMEHeader
The MIMEHeader instance used by this call (value receiver).

Returns

int — a value of this type

(MIMEHeader) clone

XuAPI
pub fn (h MIMEHeader) clone() MIMEHeader

Purpose

Operation on MIMEHeader: copy into a new independent string.

Parameters

h MIMEHeader
The MIMEHeader instance used by this call (value receiver).

Returns

MIMEHeader — a value of this type

read_mime_header_checked

XuAPI
pub fn read_mime_header_checked(src &string) HeaderRead

Purpose

Read mime header checked. Throws on failure; handle the error or propagate it to the caller.

Parameters

src &string
source (read-only borrow; caller keeps the original; type &string)

Returns

HeaderRead — a value of this type

read_mime_header

XuAPI
pub fn read_mime_header(src &string) HeaderRead

Purpose

Read mime header.

Parameters

src &string
source (read-only borrow; caller keeps the original; type &string)

Returns

HeaderRead — a value of this type

parse_code_line

XuAPI
pub fn parse_code_line(line &string) CodeLine

Purpose

Parse as code line. Throws on failure; handle the error or propagate it to the caller.

Parameters

line &string
line (read-only borrow; caller keeps the original; type &string)

Returns

CodeLine — a value of this type