XU XUv0.8.8
EN

API

#net/http2

import: #net/http2

counts: 7 函数, 5 方法, 5 类型, 1 常量, 0 方法集

标准库包 `#net/http2`。

const preface

XuAPI
pub const preface = "PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n"

用途

公开常量 `preface`。 值为 `"PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n"`

参数

无

struct Frame

XuAPI
pub struct Frame {
    pub typ int
    pub flags int
    pub stream_id int
    pub payload string
}

用途

公开结构体 `Frame`。

参数

typ int
字段(int)
flags int
字段(int)
stream_id int
字段(int)
payload string
字段(string)

struct Decoded

XuAPI
pub struct Decoded {
    pub f Frame
    pub need int
}

用途

公开结构体 `Decoded`。

参数

f Frame
回调或格式串
need int
字段(int)

struct Response

XuAPI
pub struct Response {
    pub status int
    pub body string
    pub ok bool
    pub err string
}

用途

公开结构体 `Response`。

参数

status int
字段(int)
body string
正文
ok bool
字段(bool)
err string
错误

encode_frame

XuAPI
pub fn encode_frame(typ int, flags int, sid int, payload string) string

用途

编码。

参数

typ int
typ(int)
flags int
flags(int)
sid int
sid(int)
payload string
payload(string)

返回

string — 结果字符串

decode_frame

XuAPI
pub fn decode_frame(buf string) Decoded

用途

解码。

参数

buf string
缓冲(string)

返回

Decoded — 该类型的值

encode_get_headers

XuAPI
pub fn encode_get_headers(authority string, path string) string

用途

编码。

参数

authority string
authority(string)
path string
文件系统路径(string)

返回

string — 结果字符串

encode_post_headers

XuAPI
pub fn encode_post_headers(authority string, path string, content_type string, authorization string) string

用途

编码。

参数

authority string
authority(string)
path string
文件系统路径(string)
content_type string
content_type(string)
authorization string
authorization(string)

返回

string — 结果字符串

parse_status

XuAPI
pub fn parse_status(blk string) int

用途

解析为 status。

参数

blk string
blk(string)

返回

int — 该类型的值

struct TcpClient

XuAPI
pub struct TcpClient {

}

用途

公开结构体 `TcpClient`。

参数

无

dial_tcp

XuAPI
pub fn dial_tcp(addr string) TcpClient

用途

拨 TCP。失败时 throw。

参数

addr string
地址(string)

返回

TcpClient — 该类型的值

(&mut TcpClient) get

XuAPI
pub fn (t &mut TcpClient) get(authority string, path string) Response

用途

在 `&mut TcpClient` 上调用 `get`。

参数

t &mut TcpClient
接收者 &mut TcpClient(可变借用)
authority string
authority(string)
path string
文件系统路径(string)

返回

Response — 该类型的值

(&mut TcpClient) close

XuAPI
pub fn (t &mut TcpClient) close()

用途

`&mut TcpClient` 上的方法:关闭资源。

参数

t &mut TcpClient
接收者 &mut TcpClient(可变借用)

struct TlsClient

XuAPI
pub struct TlsClient {

}

用途

公开结构体 `TlsClient`。

参数

无

dial_tls

XuAPI
pub fn dial_tls(addr string, server_name string) TlsClient

用途

拨号TLS。失败时 throw。

参数

addr string
地址(string)
server_name string
server_name(string)

返回

TlsClient — 该类型的值

(&mut TlsClient) get

XuAPI
pub fn (t &mut TlsClient) get(authority string, path string) Response

用途

在 `&mut TlsClient` 上调用 `get`。

参数

t &mut TlsClient
接收者 &mut TlsClient(可变借用)
authority string
authority(string)
path string
文件系统路径(string)

返回

Response — 该类型的值

(&mut TlsClient) post

XuAPI
pub fn (t &mut TlsClient) post(authority string, path string, content_type string, authorization string, body string) Response

用途

在 `&mut TlsClient` 上调用 `post`。

参数

t &mut TlsClient
接收者 &mut TlsClient(可变借用)
authority string
authority(string)
path string
文件系统路径(string)
content_type string
content_type(string)
authorization string
authorization(string)
body string
正文(string)

返回

Response — 该类型的值

(&mut TlsClient) close

XuAPI
pub fn (t &mut TlsClient) close()

用途

`&mut TlsClient` 上的方法:关闭资源。

参数

t &mut TlsClient
接收者 &mut TlsClient(可变借用)