XU XUv0.16.0

#mime

import: #mime

counts: 4 functions, 0 methods, 1 types, 0 constants, 0 method sets

Media-type parse and type-by-extension.

struct MediaType

XuAPI
pub struct MediaType {
    pub typ string
    pub keys []string
    pub vals []string
}

Purpose

Structure encapsulating typ, keys, vals.

Public fields

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

parse_media_type

XuAPI
pub fn parse_media_type(v &string) MediaType

Purpose

Parse as media type. Throws on failure; handle the error or propagate it to the caller.

Parameters

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

Returns

MediaType — a value of this type

format_media_type

XuAPI
pub fn format_media_type(mt &MediaType) string

Purpose

Format as media type.

Parameters

mt &MediaType
mt (read-only borrow; caller keeps the original; type &MediaType)

Returns

string — result string

type_by_extension

XuAPI
pub fn type_by_extension(ext &string) string

Purpose

Type by extension.

Parameters

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

Returns

string — result string

extensions_by_type

XuAPI
pub fn extensions_by_type(typ &string) []string

Purpose

Extensions by type.

Parameters

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

Returns

[]string — slice result