Module
Module documentation.
modulenet
Classes
Classes and inheritance.
classnet::URL
@briefCommon networking types.
@detailsProtocol implementations live in net.tcp, net.udp, net.tls, net.http and net.url.
class URL {
/*
@brief `scheme` field.Functions
Free functions and class methods.
functionnet::__net_last_error_kind
Signature
extern func __net_last_error_kind() -> Int;extern func __net_last_error_kind() -> Int;
/*
@brief Binds the low-level runtime symbol `__net_last_error_clear`.@briefBinds the low-level runtime symbol `__net_last_error_kind`.
@detailsThis function is an external entry point used by system modules to access native runtime capabilities such as filesystem, networking, threading, GC, cryptography, or platform operations. Prefer the safe wrapper functions in the same file when available. When calling this entry directly, pass validated arguments that match the signature and handle failures according to the return-value convention.
@returnReturns the operation result as `Int`.
functionnet::__net_last_error_clear
Signature
extern func __net_last_error_clear() -> Void;extern func __net_last_error_clear() -> Void;
/*
@brief Binds the low-level runtime symbol `__net_set_nonblock`.@briefBinds the low-level runtime symbol `__net_last_error_clear`.
@detailsThis function is an external entry point used by system modules to access native runtime capabilities such as filesystem, networking, threading, GC, cryptography, or platform operations. Prefer the safe wrapper functions in the same file when available. When calling this entry directly, pass validated arguments that match the signature and handle failures according to the return-value convention.
@returnVoid
functionnet::__net_set_nonblock
Signature
extern func __net_set_nonblock(fd: Int) -> Int;extern func __net_set_nonblock(fd: Int) -> Int;
/*@briefBinds the low-level runtime symbol `__net_set_nonblock`.
@detailsThis function is an external entry point used by system modules to access native runtime capabilities such as filesystem, networking, threading, GC, cryptography, or platform operations. Prefer the safe wrapper functions in the same file when available. When calling this entry directly, pass validated arguments that match the signature and handle failures according to the return-value convention.
@param
- fdOperating-system file descriptor or socket descriptor.
@returnReturns the operation result as `Int`.
functionnet::URL.init
Signature
func init(self: net.URL, scheme: String, host: String, port: Int, path: String) -> Void func init(self: net.URL, scheme: String, host: String, port: Int, path: String) -> Void {
self.scheme = scheme;
self.host = host;@briefInitializes a `URL` instance.
@detailsEstablishes the initial field state for `URL` so other methods can be called safely. Constructor logic should keep fields consistent and avoid leaking partially initialized resources.
@param
- selfThe current instance whose fields, handles, buffers, or external resources are read or modified by this method.
- schemeURL or protocol scheme such as `http`, `https`, or a database protocol name.
- hostHost name or listen address.
- portPort number.
- pathFile or directory path.
@returnVoid
functionnet::URL.deinit
Signature
func deinit(self: net.URL) -> Void func deinit(self: net.URL) -> Void {
}
}@briefReleases fallback resources at the end of the `URL` lifetime.
@detailsThis destructor hook is called by object lifetime management to clean up underlying resources that were not released explicitly. Normal application code should prefer `dispose`, `close`, or the module-specific close function to release resources at a deterministic time.
@param
- selfThe current instance whose fields, handles, buffers, or external resources are read or modified by this method.
@returnVoid
functionnet::clear_last_error
Signature
func clear_last_error() -> Voidfunc clear_last_error() -> Void {
_ = __net_last_error_clear();
}@briefProvides the system library operation `clear_last_error`.
@detailsExecutes the `clear_last_error` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@returnVoid
functionnet::last_err_code
Signature
func last_err_code() -> ErrCodefunc last_err_code() -> ErrCode {
let k: Int = __net_last_error_kind();
return match k {@briefProvides the system library operation `last_err_code`.
@detailsExecutes the `last_err_code` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@returnReturns `ErrCode`; on success the error code is `std.OK` or `OK`, and on failure the error code describes the failure while any returned value contains the usable partial result when available.
functionnet::set_nonblock
Signature
func set_nonblock(fd: Int) -> ErrCodefunc set_nonblock(fd: Int) -> ErrCode {
if fd <= 0 {
return std.ERR_INVALID;@briefSets state or configuration with `set_nonblock`.
@detailsExecutes the `set_nonblock` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- fdOperating-system file descriptor or socket descriptor.
@returnReturns `ErrCode`; on success the error code is `std.OK` or `OK`, and on failure the error code describes the failure while any returned value contains the usable partial result when available.
Variables
Class fields (var).
varnet::URL.scheme
Type
String@brief`scheme` field.
@detailsHolds the `scheme` value for each `URL` instance. The field type is `String`, and constructors and methods keep it synchronized with the object's runtime state.
var scheme: String;
/*
@brief `host` field.varnet::URL.host
Type
String@brief`host` field.
@detailsStores a host name or network address. The field type is `String`, and it is maintained by the constructors and methods of `URL`.
var host: String;
/*
@brief `port` field.varnet::URL.port
Type
Int@brief`port` field.
@detailsStores a port number. The field type is `Int`, and it is maintained by the constructors and methods of `URL`.
var port: Int;
/*
@brief `path` field.varnet::URL.path
Type
String@brief`path` field.
@detailsStores the associated filesystem path. The field type is `String`, and it is maintained by the constructors and methods of `URL`.
var path: String;
/*