Home
main
Attribute
attribute
raw_name
raw_value
class
id
href
src
rel
name
width
height
style
type
value
role
for_
action
method
min
max
hidden
Cmd
default_timeout_ms
default_output_limit_bytes
exec!
exec_str!
exec_cmd!
exec_output!
exec_output_bytes!
exec_exit_code!
new
with_timeout_millis
with_stdout_limit
with_stderr_limit
with_output_limits
new_str
arg
arg_str
args
args_str
env
env_str
envs
envs_str
clear_envs
to_str
to_inspect
Env
var!
var_str!
cwd!
set_cwd!
exe_path!
temp_dir!
dict!
platform!
ARCH
OS
File
open_reader!
open_reader_with_capacity!
Reader
to_inspect
read_line!
Html
text
dangerously_include_unescaped_html
element
void_element
render
render_without_doc_type
html
head
body
title
header
nav
main
div
span
p
a
ul
li
h1
h2
h3
h4
h5
h6
form
button
label
table
thead
tbody
tr
th
td
svg
select
option
input
meta
link
br
Node
Http
default_timeout_ms
default_max_response_bytes
default_config
with_timeout_millis
with_max_response_bytes
send!
send_with!
with_json_body
send_json!
get_utf8!
decode_json_response
get!
Config
TransportErr
IOErr
MultipartFormData
parse_form_url_encoded
parse_multipart_form_data
FormData
OsStr
from_str
utf8
unix
unix_bytes
windows
windows_u16s
from_quote
from_interpolation
to_str_try
display
to_inspect
is_eq
to_hash
to_raw
from_raw
Raw
Path
from_os_str
to_os_str
is_file!
is_dir!
is_sym_link!
exists!
type!
read_bytes!
write_bytes!
read_utf8!
write_utf8!
delete!
size_in_bytes!
is_executable!
is_readable!
is_writable!
time_accessed!
time_modified!
time_created!
hard_link!
rename!
create_dir!
create_all!
delete_empty!
delete_all!
list!
utf8
from_quote
from_interpolation
unix
unix_bytes
windows
windows_u16s
to_str
display
to_inspect
is_eq
to_hash
filename
ext
join
to_raw
from_raw
Server
default_body_limit_bytes
default_body_chunk_bytes
default_buffered_body_chunks
default_max_connections
default_max_handlers
default_max_queued_handlers
default_config
with_listen
with_limits
with_request_body_limits
with_request_body_limit
with_graceful_shutdown
respond
stop_after
stop_after_with_code
Config
to_host
Body
to_inspect
from_host
limit
content_length
with_limit
read!
read_all!
Request
method
headers
target
body
from_host
Outcome
to_host
ShutdownReason
Sleep
millis!
Sqlite
default_config
default_query_limits
open!
prepare!
execute!
query!
query_many!
begin!
errcode_to_str
Config
JournalMode
Synchronous
Db
to_inspect
Value
Binding
QueryLimits
ValueType
QueryError
Blob
from_bytes
to_bytes
parser_for
encoder_for
ParamsState
ParamsEncoding
rename_field
encode_record
encode_str
encode_i64
encode_f64
encode_bytes
encode_null
RowState
RowEncoding
rename_field
parse_str
parse_i64
parse_f64
parse_bytes
invalid_value
parse_record_field
skip_record_field
Stmt
to_inspect
execute!
query!
query_many!
Transaction
to_inspect
prepare!
execute!
query!
query_many!
commit!
rollback!
TransactionMode
ErrCode
Stderr
line!
write!
write_bytes!
Stdout
line!
write!
write_bytes!
Tcp
connect!
connect_err_to_str
stream_err_to_str
Stream
to_inspect
read_up_to!
read_exactly!
read_until!
read_line!
write!
write_utf8!
ConnectErr
StreamErr
Url
parse
from_quote
parser_for
encoder_for
to_str
to_inspect
is_eq
to_hash
scheme
host
port
path
query
fragment
without_fragment
resolve
append_path_segments
append_query_param
query_pairs
with_query
with_fragment
ParseErr
Utc
now!
to_nanos_since_epoch
from_nanos_since_epoch
to_millis_since_epoch
from_millis_since_epoch
delta_as_nanos
delta_as_millis
to_iso_8601
Attribute
.
attribute
:
Str
,
Str
->
Attribute
Attribute
.
raw_name
:
Attribute
->
Str
Attribute
.
raw_value
:
Attribute
->
Str
Attribute
.
class
:
Str
->
Attribute
Attribute
.
id
:
Str
->
Attribute
Attribute
.
href
:
Str
->
Attribute
Attribute
.
src
:
Str
->
Attribute
Attribute
.
rel
:
Str
->
Attribute
Attribute
.
name
:
Str
->
Attribute
Attribute
.
width
:
Str
->
Attribute
Attribute
.
height
:
Str
->
Attribute
Attribute
.
style
:
Str
->
Attribute
Attribute
.
type
:
Str
->
Attribute
Attribute
.
value
:
Str
->
Attribute
Attribute
.
role
:
Str
->
Attribute
Attribute
.
for_
:
Str
->
Attribute
Attribute
.
action
:
Str
->
Attribute
Attribute
.
method
:
Str
->
Attribute
Attribute
.
min
:
Str
->
Attribute
Attribute
.
max
:
Str
->
Attribute
Attribute
.
hidden
:
Str
->
Attribute
Cmd
.
default_timeout_ms
:
U64
Cmd
.
default_output_limit_bytes
:
U64
Cmd
.
exec!
:
OsStr
,
List
(
OsStr
)
=>
Try
({ }, [
ExecFailed
({ command :
Str
, exit_code :
I32
}),
FailedToGetExitCode
({ command :
Str
, err :
IOErr
}),
CommandTimedOut
({ command :
Str
, timeout_ms :
U64
}),
CommandSaturated
({ command :
Str
}), ..])
Cmd
.
exec_str!
:
Str
,
List
(
Str
)
=>
Try
({ }, [
ExecFailed
({ command :
Str
, exit_code :
I32
}),
FailedToGetExitCode
({ command :
Str
, err :
IOErr
}),
CommandTimedOut
({ command :
Str
, timeout_ms :
U64
}),
CommandSaturated
({ command :
Str
}), ..])
Cmd
.
exec_cmd!
:
Cmd
=>
Try
({ }, [
ExecCmdFailed
({ command :
Str
, exit_code :
I32
}),
FailedToGetExitCode
({ command :
Str
, err :
IOErr
}),
CommandTimedOut
({ command :
Str
, timeout_ms :
U64
}),
CommandSaturated
({ command :
Str
}), ..])
Cmd
.
exec_output!
:
Cmd
=>
Try
({ stdout_utf8 :
Str
, stderr_utf8_lossy :
Str
}, [
StdoutContainsInvalidUtf8
({ cmd_str :
Str
, err : [
BadUtf8
({ problem : _, index :
U64
})] }),
NonZeroExitCode
({ command :
Str
, exit_code :
I32
, stdout_utf8_lossy :
Str
, stderr_utf8_lossy :
Str
}),
FailedToGetExitCode
({ command :
Str
, err :
IOErr
}),
CommandTimedOut
({ command :
Str
, timeout_ms :
U64
}),
CommandSaturated
({ command :
Str
}),
StdoutLimitExceeded
({ command :
Str
, limit_bytes :
U64
, received_at_least :
U64
}),
StderrLimitExceeded
({ command :
Str
, limit_bytes :
U64
, received_at_least :
U64
}), ..])
Cmd
.
exec_output_bytes!
:
Cmd
=>
Try
({ stderr_bytes :
List
(
U8
), stdout_bytes :
List
(
U8
) }, [
NonZeroExitCodeB
({ exit_code :
I32
, stdout_bytes :
List
(
U8
), stderr_bytes :
List
(
U8
) }),
FailedToGetExitCodeB
(
IOErr
),
CommandTimedOutB
(
U64
),
CommandSaturatedB
,
StdoutLimitExceededB
({ limit_bytes :
U64
, received_at_least :
U64
}),
StderrLimitExceededB
({ limit_bytes :
U64
, received_at_least :
U64
}), ..])
Cmd
.
exec_exit_code!
:
Cmd
=>
Try
(
I32
, [
FailedToGetExitCode
({ command :
Str
, err :
IOErr
}),
CommandTimedOut
({ command :
Str
, timeout_ms :
U64
}),
CommandSaturated
({ command :
Str
}), ..])
Cmd
.
new
:
OsStr
->
Cmd
Cmd
.
with_timeout_millis
:
Cmd
,
U64
->
Cmd
Cmd
.
with_stdout_limit
:
Cmd
,
U64
->
Cmd
Cmd
.
with_stderr_limit
:
Cmd
,
U64
->
Cmd
Cmd
.
with_output_limits
:
Cmd
, { stdout_bytes :
U64
, stderr_bytes :
U64
}
->
Cmd
Cmd
.
new_str
:
Str
->
Cmd
Cmd
.
arg
:
Cmd
,
OsStr
->
Cmd
Cmd
.
arg_str
:
Cmd
,
Str
->
Cmd
Cmd
.
args
:
Cmd
,
List
(
OsStr
)
->
Cmd
Cmd
.
args_str
:
Cmd
,
List
(
Str
)
->
Cmd
Cmd
.
env
:
Cmd
,
OsStr
,
OsStr
->
Cmd
Cmd
.
env_str
:
Cmd
,
Str
,
Str
->
Cmd
Cmd
.
envs
:
Cmd
,
List
({ name :
OsStr
, value :
OsStr
})
->
Cmd
Cmd
.
envs_str
:
Cmd
,
List
({ name :
Str
, value :
Str
})
->
Cmd
Cmd
.
clear_envs
:
Cmd
->
Cmd
Cmd
.
to_str
:
Cmd
->
Str
Cmd
.
to_inspect
:
Cmd
->
Str
Env
.
var!
:
OsStr
=>
Try
(
OsStr
, [
VarNotFound
(
OsStr
),
EnvErr
(
IOErr
), ..])
Env
.
var_str!
:
OsStr
=>
Try
(
Str
, [
VarNotFound
(
OsStr
),
EnvErr
(
IOErr
),
InvalidStr
(
U64
), ..])
Env
.
cwd!
: ()
=>
Try
(
Path
, [
CwdUnavailable
, ..])
Env
.
set_cwd!
:
Path
=>
Try
({ }, [
InvalidCwd
(
IOErr
), ..])
Env
.
exe_path!
: ()
=>
Try
(
Path
, [
ExePathUnavailable
, ..])
Env
.
temp_dir!
: ()
=>
Path
Env
.
dict!
: ()
=>
List
({ name :
OsStr
, value :
OsStr
})
Env
.
platform!
: ()
=>
{ arch :
ARCH
, os :
OS
}
Env
.
ARCH
: [
X86
,
X64
,
ARM
,
AARCH64
,
OTHER
(
Str
)]
Env
.
OS
: [
LINUX
,
MACOS
,
WINDOWS
,
OTHER
(
Str
)]
File
.
open_reader!
:
Path
=>
Try
(
Reader
, [
FileErr
(
IOErr
)])
File
.
open_reader_with_capacity!
:
Path
,
U64
=>
Try
(
Reader
, [
FileErr
(
IOErr
)])
File
.
Reader
File.Reader
.
to_inspect
:
Reader
->
Str
File.Reader
.
read_line!
:
Reader
=>
Try
(
List
(
U8
), _)
Html
.
text
:
Str
->
HtmlNode
Html
.
dangerously_include_unescaped_html
:
Str
->
HtmlNode
Html
.
element
:
Str
,
List
(
Attribute
),
List
(
HtmlNode
)
->
HtmlNode
Html
.
void_element
:
Str
,
List
(
Attribute
)
->
HtmlNode
Html
.
render
:
HtmlNode
->
Str
Html
.
render_without_doc_type
:
HtmlNode
->
Str
Html
.
html
:
List
(
Attribute
),
List
(
HtmlNode
)
->
HtmlNode
Html
.
head
:
List
(
Attribute
),
List
(
HtmlNode
)
->
HtmlNode
Html
.
body
:
List
(
Attribute
),
List
(
HtmlNode
)
->
HtmlNode
Html
.
title
:
List
(
Attribute
),
List
(
HtmlNode
)
->
HtmlNode
Html
.
header
:
List
(
Attribute
),
List
(
HtmlNode
)
->
HtmlNode
Html
.
nav
:
List
(
Attribute
),
List
(
HtmlNode
)
->
HtmlNode
Html
.
main
:
List
(
Attribute
),
List
(
HtmlNode
)
->
HtmlNode
Html
.
div
:
List
(
Attribute
),
List
(
HtmlNode
)
->
HtmlNode
Html
.
span
:
List
(
Attribute
),
List
(
HtmlNode
)
->
HtmlNode
Html
.
p
:
List
(
Attribute
),
List
(
HtmlNode
)
->
HtmlNode
Html
.
a
:
List
(
Attribute
),
List
(
HtmlNode
)
->
HtmlNode
Html
.
ul
:
List
(
Attribute
),
List
(
HtmlNode
)
->
HtmlNode
Html
.
li
:
List
(
Attribute
),
List
(
HtmlNode
)
->
HtmlNode
Html
.
h1
:
List
(
Attribute
),
List
(
HtmlNode
)
->
HtmlNode
Html
.
h2
:
List
(
Attribute
),
List
(
HtmlNode
)
->
HtmlNode
Html
.
h3
:
List
(
Attribute
),
List
(
HtmlNode
)
->
HtmlNode
Html
.
h4
:
List
(
Attribute
),
List
(
HtmlNode
)
->
HtmlNode
Html
.
h5
:
List
(
Attribute
),
List
(
HtmlNode
)
->
HtmlNode
Html
.
h6
:
List
(
Attribute
),
List
(
HtmlNode
)
->
HtmlNode
Html
.
form
:
List
(
Attribute
),
List
(
HtmlNode
)
->
HtmlNode
Html
.
button
:
List
(
Attribute
),
List
(
HtmlNode
)
->
HtmlNode
Html
.
label
:
List
(
Attribute
),
List
(
HtmlNode
)
->
HtmlNode
Html
.
table
:
List
(
Attribute
),
List
(
HtmlNode
)
->
HtmlNode
Html
.
thead
:
List
(
Attribute
),
List
(
HtmlNode
)
->
HtmlNode
Html
.
tbody
:
List
(
Attribute
),
List
(
HtmlNode
)
->
HtmlNode
Html
.
tr
:
List
(
Attribute
),
List
(
HtmlNode
)
->
HtmlNode
Html
.
th
:
List
(
Attribute
),
List
(
HtmlNode
)
->
HtmlNode
Html
.
td
:
List
(
Attribute
),
List
(
HtmlNode
)
->
HtmlNode
Html
.
svg
:
List
(
Attribute
),
List
(
HtmlNode
)
->
HtmlNode
Html
.
select
:
List
(
Attribute
),
List
(
HtmlNode
)
->
HtmlNode
Html
.
option
:
List
(
Attribute
),
List
(
HtmlNode
)
->
HtmlNode
Html
.
input
:
List
(
Attribute
)
->
HtmlNode
Html
.
meta
:
List
(
Attribute
)
->
HtmlNode
Html
.
link
:
List
(
Attribute
)
->
HtmlNode
Html
.
br
:
List
(
Attribute
)
->
HtmlNode
Html
.
Node
:
HtmlNode
Http
.
default_timeout_ms
:
U64
Http
.
default_max_response_bytes
:
U64
Http
.
default_config
:
Config
Http
.
with_timeout_millis
:
Config
,
U64
->
Config
Http
.
with_max_response_bytes
:
Config
,
U64
->
Config
Http
.
send!
:
Request
=>
Try
(
Response
, [
InvalidUrl
(
ParseErr
),
InvalidRequest
(
Str
),
HttpErr
(
TransportErr
), ..])
Http
.
send_with!
:
Request
,
Config
=>
Try
(
Response
, [
InvalidUrl
(
ParseErr
),
InvalidRequest
(
Str
),
HttpErr
(
TransportErr
), ..])
Http
.
with_json_body
:
Request
, _
=>
Try
(
Request
, [
JsonErr
(_), ..])
Http
.
send_json!
:
Request
, _
=>
Try
(
Response
, [
JsonErr
(_),
InvalidUrl
(
ParseErr
),
InvalidRequest
(
Str
),
HttpErr
(
TransportErr
), ..])
Http
.
get_utf8!
:
Url
=>
Try
(
Str
, [
BadBody
(
Str
),
InvalidRequest
(
Str
),
HttpErr
(
TransportErr
), ..])
Http
.
decode_json_response
:
Response
=>
Try
(_, [
BadBody
(
Str
),
JsonErr
(_), ..])
Http
.
get!
:
Url
=>
Try
(_, [
BadBody
(
Str
),
InvalidRequest
(
Str
),
HttpErr
(
TransportErr
),
JsonErr
(_), ..])
Http
.
Config
:= [
Config
({ timeout_ms :
U64
, max_response_bytes :
U64
})]
Http
.
TransportErr
:
TransportErr
MultipartFormData
.
parse_form_url_encoded
:
List
(
U8
)
->
Try
(
Dict
(
Str
,
Str
), [
BadUtf8
,
InvalidPercentEncoding
])
MultipartFormData
.
parse_multipart_form_data
: { headers :
List
(
Header
), body :
List
(
U8
) }
->
Try
(
List
(
FormData
), [
InvalidMultipartFormData
,
ExpectedContentTypeHeader
,
InvalidContentTypeHeader
])
MultipartFormData
.
FormData
: { disposition :
List
(
U8
), type :
List
(
U8
), encoding :
List
(
U8
), data :
List
(
U8
) }
OsStr
.
from_str
:
Str
->
OsStr
OsStr
.
utf8
:
Str
->
OsStr
OsStr
.
unix
:
Str
->
OsStr
OsStr
.
unix_bytes
:
List
(
U8
)
->
OsStr
OsStr
.
windows
:
Str
->
OsStr
OsStr
.
windows_u16s
:
List
(
U16
)
->
OsStr
OsStr
.
from_quote
:
Str
->
Try
(
OsStr
, [
BadQuotedBytes
(
Str
)])
OsStr
.
from_interpolation
:
Str
,
Iter
((
Str
,
Str
))
->
OsStr
OsStr
.
to_str_try
:
OsStr
->
Try
(
Str
, [
InvalidStr
(
U64
)])
OsStr
.
display
:
OsStr
->
Str
OsStr
.
to_inspect
:
OsStr
->
Str
OsStr
.
is_eq
:
OsStr
,
OsStr
->
Bool
OsStr
.
to_hash
:
OsStr
,
Hasher
->
Hasher
OsStr
.
to_raw
:
OsStr
->
Raw
OsStr
.
from_raw
:
Raw
->
OsStr
OsStr
.
Raw
: [
Utf8
(
Str
),
UnixBytes
(
List
(
U8
)),
WindowsU16s
(
List
(
U16
))]
Path
.
from_os_str
:
OsStr
->
Path
Path
.
to_os_str
:
Path
->
OsStr
Path
.
is_file!
:
Path
=>
Try
(
Bool
, [
PathErr
(
IOErr
), ..])
Path
.
is_dir!
:
Path
=>
Try
(
Bool
, [
PathErr
(
IOErr
), ..])
Path
.
is_sym_link!
:
Path
=>
Try
(
Bool
, [
PathErr
(
IOErr
), ..])
Path
.
exists!
:
Path
=>
Try
(
Bool
, [
PathErr
(
IOErr
), ..])
Path
.
type!
:
Path
=>
Try
([
IsFile
,
IsDir
,
IsSymLink
,
IsOther
], [
PathErr
(
IOErr
), ..])
Path
.
read_bytes!
:
Path
=>
Try
(
List
(
U8
), [
PathErr
(
IOErr
), ..])
Path
.
write_bytes!
:
Path
,
List
(
U8
)
=>
Try
({ }, [
PathErr
(
IOErr
), ..])
Path
.
read_utf8!
:
Path
=>
Try
(
Str
, [
PathErr
(
IOErr
), ..])
Path
.
write_utf8!
:
Path
,
Str
=>
Try
({ }, [
PathErr
(
IOErr
), ..])
Path
.
delete!
:
Path
=>
Try
({ }, [
PathErr
(
IOErr
), ..])
Path
.
size_in_bytes!
:
Path
=>
Try
(
U64
, [
PathErr
(
IOErr
), ..])
Path
.
is_executable!
:
Path
=>
Try
(
Bool
, [
PathErr
(
IOErr
), ..])
Path
.
is_readable!
:
Path
=>
Try
(
Bool
, [
PathErr
(
IOErr
), ..])
Path
.
is_writable!
:
Path
=>
Try
(
Bool
, [
PathErr
(
IOErr
), ..])
Path
.
time_accessed!
:
Path
=>
Try
(
U128
, [
PathErr
(
IOErr
), ..])
Path
.
time_modified!
:
Path
=>
Try
(
U128
, [
PathErr
(
IOErr
), ..])
Path
.
time_created!
:
Path
=>
Try
(
U128
, [
PathErr
(
IOErr
), ..])
Path
.
hard_link!
:
Path
,
Path
=>
Try
({ }, [
PathErr
(
IOErr
), ..])
Path
.
rename!
:
Path
,
Path
=>
Try
({ }, [
PathErr
(
IOErr
), ..])
Path
.
create_dir!
:
Path
=>
Try
({ }, [
PathErr
(
IOErr
), ..])
Path
.
create_all!
:
Path
=>
Try
({ }, [
PathErr
(
IOErr
), ..])
Path
.
delete_empty!
:
Path
=>
Try
({ }, [
PathErr
(
IOErr
), ..])
Path
.
delete_all!
:
Path
=>
Try
({ }, [
PathErr
(
IOErr
), ..])
Path
.
list!
:
Path
=>
Try
(
List
(
Path
), [
PathErr
(
IOErr
), ..])
Path
.
utf8
:
Str
->
Path
Path
.
from_quote
:
Str
->
Try
(
Path
, [
BadQuotedBytes
(
Str
)])
Path
.
from_interpolation
:
Str
,
Iter
((
Str
,
Str
))
->
Path
Path
.
unix
:
Str
->
Path
Path
.
unix_bytes
:
List
(
U8
)
->
Path
Path
.
windows
:
Str
->
Path
Path
.
windows_u16s
:
List
(
U16
)
->
Path
Path
.
to_str
:
Path
->
Try
(
Str
, [
InvalidStr
(
U64
)])
Path
.
display
:
Path
->
Str
Path
.
to_inspect
:
Path
->
Str
Path
.
is_eq
:
Path
,
Path
->
Bool
Path
.
to_hash
:
Path
,
Hasher
->
Hasher
Path
.
filename
:
Path
->
Try
(
Path
, [
IsDirPath
,
EndsInDots
])
Path
.
ext
:
Path
->
Try
(
Path
, [
IsDirPath
,
EndsInDots
])
Path
.
join
:
Path
,
Str
->
Path
Path
.
to_raw
:
Path
->
[
Utf8
(
Str
),
UnixBytes
(
List
(
U8
)),
WindowsU16s
(
List
(
U16
))]
Path
.
from_raw
: [
Utf8
(
Str
),
UnixBytes
(
List
(
U8
)),
WindowsU16s
(
List
(
U16
))]
->
Path
Server
.
default_body_limit_bytes
:
U64
Server
.
default_body_chunk_bytes
:
U32
Server
.
default_buffered_body_chunks
:
U16
Server
.
default_max_connections
:
U32
Server
.
default_max_handlers
:
U16
Server
.
default_max_queued_handlers
:
U16
Server
.
default_config
:
Config
Server
.
with_listen
:
Config
, { host :
Str
, port :
U16
}
->
Config
Server
.
with_limits
:
Config
, { max_connections :
U32
, max_handlers :
U16
, max_queued_handlers :
U16
}
->
Config
Server
.
with_request_body_limits
:
Config
, { max_bytes :
U64
, chunk_bytes :
U32
, buffered_chunks :
U16
}
->
Config
Server
.
with_request_body_limit
:
Config
,
U64
->
Config
Server
.
with_graceful_shutdown
:
Config
, { drain_timeout_ms :
U64
, hook_timeout_ms :
U64
}
->
Config
Server
.
respond
:
Response
->
Outcome
Server
.
stop_after
:
Response
->
Outcome
Server
.
stop_after_with_code
:
Response
,
I64
->
Outcome
Server
.
Config
:= [
Config
({ listen : { host :
Str
, port :
U16
}, limits : { max_connections :
U32
, max_handlers :
U16
, max_queued_handlers :
U16
}, request_bodies : { max_bytes :
U64
, chunk_bytes :
U32
, buffered_chunks :
U16
}, graceful_shutdown : { drain_timeout_ms :
U64
, hook_timeout_ms :
U64
} })]
Server.Config
.
to_host
:
Config
->
{ host :
Str
, port :
U16
, body_max_bytes :
U64
, body_chunk_bytes :
U32
, body_buffered_chunks :
U16
, drain_timeout_ms :
U64
, hook_timeout_ms :
U64
, max_connections :
U32
, max_handlers :
U16
, max_queued_handlers :
U16
}
Server
.
Body
:= [
Body
({ host_id :
U64
, limit_bytes :
U64
, content_length : [
Unknown
,
Known
(
U64
)] })]
Server.Body
.
to_inspect
:
Body
->
Str
Server.Body
.
from_host
:
U64
,
U64
, [
Unknown
,
Known
(
U64
)]
->
Body
Server.Body
.
limit
:
Body
->
U64
Server.Body
.
content_length
:
Body
->
[
Unknown
,
Known
(
U64
)]
Server.Body
.
with_limit
:
Body
,
U64
->
Body
Server.Body
.
read!
:
Body
=>
Try
(
Read
, [
RequestBodyErr
(
Err
)])
Server.Body
.
read_all!
:
Body
=>
Try
(
List
(
U8
), [
RequestBodyErr
(
Err
)])
Server
.
Request
:= { method :
Method
, headers :
List
(
Header
), target :
Str
, body :
Body
}
Server.Request
.
method
:
Request
->
Method
Server.Request
.
headers
:
Request
->
List
(
Header
)
Server.Request
.
target
:
Request
->
Str
Server.Request
.
body
:
Request
->
Body
Server.Request
.
from_host
:
Method
,
List
(
Header
),
Str
,
Body
->
Request
Server
.
Outcome
:= [
Respond
(
Response
),
StopAfter
({ response :
Response
, exit_code :
I64
})]
Server.Outcome
.
to_host
:
Outcome
->
{ response :
Response
, stop :
Bool
, exit_code :
I64
}
Server
.
ShutdownReason
: [
ApplicationRequested
,
Interrupt
,
Terminate
,
StartupFailed
(
Str
),
RuntimeFailed
(
Str
)]
Sleep
.
millis!
:
U64
=>
{ }
Sqlite
.
default_config
:
Path
->
Config
Sqlite
.
default_query_limits
:
QueryLimits
Sqlite
.
open!
:
Config
=>
Try
(
Db
,
QueryError
)
Sqlite
.
prepare!
: { db :
Db
, query :
Str
}
=>
Try
(
Stmt
,
QueryError
)
Sqlite
.
execute!
: { db :
Db
, query :
Str
, params :
params
}
=>
Try
({ },
QueryError
)
where
[
params
.encoder_for :
ParamsEncoding
->
params
,
ParamsState
->
Try
(
ParamsState
,
QueryError
)]
Sqlite
.
query!
: { db :
Db
, query :
Str
, params :
params
, limits :
QueryLimits
}
=>
Try
(
row
,
QueryError
)
where
[
params
.encoder_for :
ParamsEncoding
->
params
,
ParamsState
->
Try
(
ParamsState
,
QueryError
),
row
.parser_for :
RowEncoding
->
RowState
->
Try
({ value :
row
, rest :
RowState
},
QueryError
)]
Sqlite
.
query_many!
: { db :
Db
, query :
Str
, params :
params
, limits :
QueryLimits
}
=>
Try
(
List
(
row
),
QueryError
)
where
[
params
.encoder_for :
ParamsEncoding
->
params
,
ParamsState
->
Try
(
ParamsState
,
QueryError
),
row
.parser_for :
RowEncoding
->
RowState
->
Try
({ value :
row
, rest :
RowState
},
QueryError
)]
Sqlite
.
begin!
:
Db
,
TransactionMode
=>
Try
(
Transaction
,
QueryError
)
Sqlite
.
errcode_to_str
: [
Abort
,
AuthDenied
,
Busy
,
CanNotOpen
,
Constraint
,
Corrupt
,
Done
,
Empty
,
Error
,
Format
,
Full
,
IOErr
,
Internal
,
Interrupt
,
Locked
,
Mismatch
,
Misuse
,
NoLFS
,
NoMem
,
NotADatabase
,
NotFound
,
Notice
,
OutOfRange
,
Perm
,
Protocol
,
ReadOnly
,
Row
,
Schema
,
TooBig
,
Warning
,
Unknown
(
I64
)]
->
Str
Sqlite
.
Config
: { path :
Path
, max_connections :
U64
, acquire_timeout_ms :
U64
, busy_timeout_ms :
U64
, max_cached_statements_per_connection :
U64
, journal_mode :
JournalMode
, synchronous :
Synchronous
}
Sqlite
.
JournalMode
: [
Delete
,
Wal
]
Sqlite
.
Synchronous
: [
Full
,
Normal
]
Sqlite
.
Db
Sqlite.Db
.
to_inspect
:
Db
->
Str
Sqlite
.
Value
: [
Null
,
Real
(
F64
),
Integer
(
I64
),
String
(
Str
),
Bytes
(
List
(
U8
))]
Sqlite
.
Binding
: { name :
Str
, value :
Value
}
Sqlite
.
QueryLimits
: { max_bytes :
U64
, max_rows :
U64
, timeout_ms :
U64
}
Sqlite
.
ValueType
: [
Blob
,
Integer
,
Null
,
Real
,
Text
]
Sqlite
.
QueryError
: [
DuplicateColumn
(
Str
),
ExpectedSingleColumn
({ actual :
U64
}),
InvalidValue
({ column :
Str
}),
MalformedRow
,
MissingRequiredField
(
Str
),
MultipleValuesForParameter
,
NestedParameterRecord
,
NoRowsReturned
,
ParameterValueMissing
(
Str
),
ParameterValueOutsideRecord
,
PoolSaturated
,
QueryTimedOut
,
ResourceSaturated
,
ResultTooLarge
({ max_bytes :
U64
}),
RowsReturnedUseQueryInstead
,
SqliteErr
(
ErrCode
,
Str
),
TooManyRows
({ max_rows :
U64
}),
TooManyRowsReturned
,
ConcurrentTransactionUse
,
TransactionFinished
,
UnconsumedColumns
,
UnexpectedType
({ actual :
ValueType
, column :
Str
, expected :
ValueType
})]
Sqlite
.
Blob
Sqlite.Blob
.
from_bytes
:
List
(
U8
)
->
Blob
Sqlite.Blob
.
to_bytes
:
Blob
->
List
(
U8
)
Sqlite.Blob
.
parser_for
:
RowEncoding
->
RowState
->
Try
({ rest :
RowState
, value :
Blob
}, [
MalformedRow
,
UnconsumedColumns
, ..[
ConcurrentTransactionUse
,
DuplicateColumn
(
Str
),
ExpectedSingleColumn
({ actual :
U64
}),
InvalidValue
({ column :
Str
}),
MissingRequiredField
(
Str
),
MultipleValuesForParameter
,
NestedParameterRecord
,
NoRowsReturned
,
ParameterValueMissing
(
Str
),
ParameterValueOutsideRecord
,
PoolSaturated
,
QueryTimedOut
,
ResourceSaturated
,
ResultTooLarge
({ max_bytes :
U64
}),
RowsReturnedUseQueryInstead
,
SqliteErr
(
ErrCode
,
Str
),
TooManyRows
({ max_rows :
U64
}),
TooManyRowsReturned
,
TransactionFinished
,
UnexpectedType
({ actual :
ValueType
, column :
Str
, expected :
ValueType
})]])
Sqlite.Blob
.
encoder_for
:
encoding
->
Blob
,
state
->
Try
(
state
,
err
)
where
[
encoding
.encode_bytes :
List
(
U8
),
state
->
Try
(
state
,
err
)]
Sqlite
.
ParamsState
: { bindings :
List
(
Binding
), field : [
Field
(
Str
),
NoField
], value : [
Encoded
(
Value
),
NoValue
] }
Sqlite
.
ParamsEncoding
Sqlite.ParamsEncoding
.
rename_field
:
ParamsEncoding
,
Str
->
Str
Sqlite.ParamsEncoding
.
encode_record
:
ParamsState
,
U64
, (
ParamsState
, (
ParamsState
,
Str
, (
ParamsState
->
Try
(
ParamsState
,
QueryError
))
->
Try
(
ParamsState
,
QueryError
))
->
Try
(
ParamsState
,
QueryError
))
->
Try
(
ParamsState
,
QueryError
)
Sqlite.ParamsEncoding
.
encode_str
:
Str
,
ParamsState
->
Try
(
ParamsState
,
QueryError
)
Sqlite.ParamsEncoding
.
encode_i64
:
I64
,
ParamsState
->
Try
(
ParamsState
,
QueryError
)
Sqlite.ParamsEncoding
.
encode_f64
:
F64
,
ParamsState
->
Try
(
ParamsState
,
QueryError
)
Sqlite.ParamsEncoding
.
encode_bytes
:
List
(
U8
),
ParamsState
->
Try
(
ParamsState
,
QueryError
)
Sqlite.ParamsEncoding
.
encode_null
:
ParamsState
->
Try
(
ParamsState
,
QueryError
)
Sqlite
.
RowState
: { columns :
List
(
Str
), current : [
Current
({ name :
Str
, value :
Value
}),
NoCurrent
], next :
U64
, values :
List
(
Value
) }
Sqlite
.
RowEncoding
Sqlite.RowEncoding
.
rename_field
:
RowEncoding
,
Str
->
Str
Sqlite.RowEncoding
.
parse_str
:
RowEncoding
,
RowState
->
Try
({ value :
Str
, rest :
RowState
},
QueryError
)
Sqlite.RowEncoding
.
parse_i64
:
RowEncoding
,
RowState
->
Try
({ value :
I64
, rest :
RowState
},
QueryError
)
Sqlite.RowEncoding
.
parse_f64
:
RowEncoding
,
RowState
->
Try
({ value :
F64
, rest :
RowState
},
QueryError
)
Sqlite.RowEncoding
.
parse_bytes
:
RowEncoding
,
RowState
->
Try
({ value :
List
(
U8
), rest :
RowState
},
QueryError
)
Sqlite.RowEncoding
.
invalid_value
:
RowEncoding
,
RowState
->
QueryError
Sqlite.RowEncoding
.
parse_record_field
:
RowEncoding
,
FieldNames
(
_shape
),
RowState
->
Try
([
Field
({ field :
FieldName
(
_shape
), rest :
RowState
}),
TryField
({ name :
Str
, rest :
RowState
}),
TryFieldCaseless
({ name :
Str
, rest :
RowState
}),
Continue
({ rest :
RowState
}),
Done
({ rest :
RowState
})],
QueryError
)
Sqlite.RowEncoding
.
skip_record_field
:
RowEncoding
,
RowState
->
Try
(
RowState
,
QueryError
)
Sqlite
.
Stmt
Sqlite.Stmt
.
to_inspect
:
Stmt
->
Str
Sqlite.Stmt
.
execute!
:
Stmt
,
params
=>
Try
({ },
QueryError
)
where
[
params
.encoder_for :
ParamsEncoding
->
params
,
ParamsState
->
Try
(
ParamsState
,
QueryError
)]
Sqlite.Stmt
.
query!
:
Stmt
,
params
,
QueryLimits
=>
Try
(
row
,
QueryError
)
where
[
params
.encoder_for :
ParamsEncoding
->
params
,
ParamsState
->
Try
(
ParamsState
,
QueryError
),
row
.parser_for :
RowEncoding
->
RowState
->
Try
({ value :
row
, rest :
RowState
},
QueryError
)]
Sqlite.Stmt
.
query_many!
:
Stmt
,
params
,
QueryLimits
=>
Try
(
List
(
row
),
QueryError
)
where
[
params
.encoder_for :
ParamsEncoding
->
params
,
ParamsState
->
Try
(
ParamsState
,
QueryError
),
row
.parser_for :
RowEncoding
->
RowState
->
Try
({ value :
row
, rest :
RowState
},
QueryError
)]
Sqlite
.
Transaction
Sqlite.Transaction
.
to_inspect
:
Transaction
->
Str
Sqlite.Transaction
.
prepare!
:
Transaction
,
Str
=>
Try
(
Stmt
,
QueryError
)
Sqlite.Transaction
.
execute!
:
Transaction
, { query :
Str
, params :
params
}
=>
Try
({ },
QueryError
)
where
[
params
.encoder_for :
ParamsEncoding
->
params
,
ParamsState
->
Try
(
ParamsState
,
QueryError
)]
Sqlite.Transaction
.
query!
:
Transaction
, { query :
Str
, params :
params
, limits :
QueryLimits
}
=>
Try
(
row
,
QueryError
)
where
[
params
.encoder_for :
ParamsEncoding
->
params
,
ParamsState
->
Try
(
ParamsState
,
QueryError
),
row
.parser_for :
RowEncoding
->
RowState
->
Try
({ value :
row
, rest :
RowState
},
QueryError
)]
Sqlite.Transaction
.
query_many!
:
Transaction
, { query :
Str
, params :
params
, limits :
QueryLimits
}
=>
Try
(
List
(
row
),
QueryError
)
where
[
params
.encoder_for :
ParamsEncoding
->
params
,
ParamsState
->
Try
(
ParamsState
,
QueryError
),
row
.parser_for :
RowEncoding
->
RowState
->
Try
({ value :
row
, rest :
RowState
},
QueryError
)]
Sqlite.Transaction
.
commit!
:
Transaction
=>
Try
({ },
QueryError
)
Sqlite.Transaction
.
rollback!
:
Transaction
=>
Try
({ },
QueryError
)
Sqlite
.
TransactionMode
: [
Deferred
,
Immediate
,
Exclusive
]
Sqlite
.
ErrCode
: [
Error
,
Internal
,
Perm
,
Abort
,
Busy
,
Locked
,
NoMem
,
ReadOnly
,
Interrupt
,
IOErr
,
Corrupt
,
NotFound
,
Full
,
CanNotOpen
,
Protocol
,
Empty
,
Schema
,
TooBig
,
Constraint
,
Mismatch
,
Misuse
,
NoLFS
,
AuthDenied
,
Format
,
OutOfRange
,
NotADatabase
,
Notice
,
Warning
,
Row
,
Done
,
Unknown
(
I64
)]
Stderr
.
line!
:
Str
=>
Try
({ }, [
StderrErr
(
IOErr
), ..])
Stderr
.
write!
:
Str
=>
Try
({ }, [
StderrErr
(
IOErr
), ..])
Stderr
.
write_bytes!
:
List
(
U8
)
=>
Try
({ }, [
StderrErr
(
IOErr
), ..])
Stdout
.
line!
:
Str
=>
Try
({ }, [
StdoutErr
(
IOErr
), ..])
Stdout
.
write!
:
Str
=>
Try
({ }, [
StdoutErr
(
IOErr
), ..])
Stdout
.
write_bytes!
:
List
(
U8
)
=>
Try
({ }, [
StdoutErr
(
IOErr
), ..])
Tcp
.
connect!
:
Str
,
U16
=>
Try
(
Stream
,
ConnectErr
)
Tcp
.
connect_err_to_str
: [
AddrInUse
,
AddrNotAvailable
,
CapacityExhausted
,
ConnectionRefused
,
Interrupted
,
PermissionDenied
,
TimedOut
,
Unsupported
,
Unrecognized
(
a
)]
->
Str
Tcp
.
stream_err_to_str
: [
BrokenPipe
,
ConnectionRefused
,
ConnectionReset
,
Interrupted
,
OutOfMemory
,
PermissionDenied
,
ReadLimitExceeded
,
StreamBusy
,
StreamNotFound
,
TimedOut
,
Unrecognized
(
a
)]
->
Str
Tcp
.
Stream
Tcp.Stream
.
to_inspect
:
Stream
->
Str
Tcp.Stream
.
read_up_to!
:
Stream
,
U64
=>
Try
(
List
(
U8
), _)
Tcp.Stream
.
read_exactly!
:
Stream
,
U64
=>
Try
(
List
(
U8
), _)
Tcp.Stream
.
read_until!
:
Stream
,
U8
=>
Try
(
List
(
U8
), _)
Tcp.Stream
.
read_line!
:
Stream
=>
Try
(
Str
, _)
Tcp.Stream
.
write!
:
Stream
,
List
(
U8
)
=>
Try
({ }, _)
Tcp.Stream
.
write_utf8!
:
Stream
,
Str
=>
Try
({ }, _)
Tcp
.
ConnectErr
: [
CapacityExhausted
,
PermissionDenied
,
AddrInUse
,
AddrNotAvailable
,
ConnectionRefused
,
Interrupted
,
TimedOut
,
Unsupported
,
Unrecognized
(
Str
)]
Tcp
.
StreamErr
: [
StreamNotFound
,
StreamBusy
,
ReadLimitExceeded
,
PermissionDenied
,
ConnectionRefused
,
ConnectionReset
,
Interrupted
,
TimedOut
,
OutOfMemory
,
BrokenPipe
,
Unrecognized
(
Str
)]
Url
.
parse
:
Str
->
Try
(
Url
,
ParseErr
)
Url
.
from_quote
:
Str
->
Try
(
Url
, [
BadQuotedBytes
(
Str
)])
Url
.
parser_for
:
encoding
->
state
->
Try
({ value :
Url
, rest :
state
},
err
)
where
[
encoding
.parse_str :
encoding
,
state
->
Try
({ value :
Str
, rest :
state
},
err
),
encoding
.invalid_value :
encoding
,
state
->
err
]
Url
.
encoder_for
:
encoding
->
Url
,
state
->
Try
(
state
,
err
)
where
[
encoding
.encode_str :
Str
,
state
->
Try
(
state
,
err
)]
Url
.
to_str
:
Url
->
Str
Url
.
to_inspect
:
Url
->
Str
Url
.
is_eq
:
Url
,
Url
->
Bool
Url
.
to_hash
:
Url
,
Hasher
->
Hasher
Url
.
scheme
:
Url
->
[
Http
,
Https
]
Url
.
host
:
Url
->
Str
Url
.
port
:
Url
->
[
None
,
Some
(
U16
)]
Url
.
path
:
Url
->
Str
Url
.
query
:
Url
->
[
None
,
Some
(
Str
)]
Url
.
fragment
:
Url
->
[
None
,
Some
(
Str
)]
Url
.
without_fragment
:
Url
->
Url
Url
.
resolve
:
Url
,
Str
->
Try
(
Url
,
ParseErr
)
Url
.
append_path_segments
:
Url
,
List
(
Str
)
->
Url
Url
.
append_query_param
:
Url
,
Str
,
Str
->
Url
Url
.
query_pairs
:
Url
->
List
((
Str
,
Str
))
Url
.
with_query
:
Url
, [
None
,
Some
(
Str
)]
->
Try
(
Url
,
ParseErr
)
Url
.
with_fragment
:
Url
, [
None
,
Some
(
Str
)]
->
Try
(
Url
,
ParseErr
)
Url
.
ParseErr
: [
CredentialsNotAllowed
,
EmptyHost
,
InternationalHostUnsupported
,
InvalidCharacter
(
U8
),
InvalidHost
(
Str
),
InvalidIpv4
(
Str
),
InvalidIpv6
(
Str
),
InvalidPercentEncoding
(
U64
),
InvalidPort
(
Str
),
MissingAuthority
,
MissingScheme
,
PortOutOfRange
(
U64
),
UnsupportedScheme
(
Str
)]
Utc
.
now!
: ()
=>
U128
Utc
.
to_nanos_since_epoch
:
U128
->
U128
Utc
.
from_nanos_since_epoch
:
U128
->
U128
Utc
.
to_millis_since_epoch
:
U128
->
U128
Utc
.
from_millis_since_epoch
:
U128
->
U128
Utc
.
delta_as_nanos
:
U128
,
U128
->
U128
Utc
.
delta_as_millis
:
U128
,
U128
->
U128
Utc
.
to_iso_8601
:
U128
->
Str