Module
Module documentation.
modulenet.url
Classes
Classes and inheritance.
classnet.url::URL
@brief`URL` type.
@details`URL` encapsulates state and operations exported by the system module. It commonly stores runtime handles, protocol state, buffers, configuration, or collection data. Its methods define the primary behavior for the type. If the type owns external resources, prefer `dispose` or `close` for deterministic release.
class URL {
/*
@brief `scheme` field.Functions
Free functions and class methods.
functionnet.url::__url_scheme
Signature
extern func __url_scheme(url: String) -> String;extern func __url_scheme(url: String) -> String;
/*
@brief Binds the low-level runtime symbol `__url_host`.@briefBinds the low-level runtime symbol `__url_scheme`.
@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
- urlTarget URL string.
@returnReturns the operation result as `String`.
functionnet.url::__url_host
Signature
extern func __url_host(url: String) -> String;extern func __url_host(url: String) -> String;
/*
@brief Binds the low-level runtime symbol `__url_port`.@briefBinds the low-level runtime symbol `__url_host`.
@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
- urlTarget URL string.
@returnReturns the operation result as `String`.
functionnet.url::__url_port
Signature
extern func __url_port(url: String) -> Int;extern func __url_port(url: String) -> Int;
/*
@brief Binds the low-level runtime symbol `__url_path`.@briefBinds the low-level runtime symbol `__url_port`.
@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
- urlTarget URL string.
@returnReturns the operation result as `Int`.
functionnet.url::__url_path
Signature
extern func __url_path(url: String) -> String;extern func __url_path(url: String) -> String;
/*@briefBinds the low-level runtime symbol `__url_path`.
@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
- urlTarget URL string.
@returnReturns the operation result as `String`.
functionnet.url::url_scheme
Signature
func url_scheme(url: String) -> Stringfunc url_scheme(url: String) -> String {
return __url_scheme(url);
}@briefProvides the system library operation `url_scheme`.
@detailsExecutes the `url_scheme` 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
- urlTarget URL string.
@returnReturns the operation result as `String`.
functionnet.url::url_host
Signature
func url_host(url: String) -> Stringfunc url_host(url: String) -> String {
return __url_host(url);
}@briefProvides the system library operation `url_host`.
@detailsExecutes the `url_host` 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
- urlTarget URL string.
@returnReturns the operation result as `String`.
functionnet.url::url_port
Signature
func url_port(url: String) -> Intfunc url_port(url: String) -> Int {
return __url_port(url);
}@briefProvides the system library operation `url_port`.
@detailsExecutes the `url_port` 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
- urlTarget URL string.
@returnReturns the operation result as `Int`.
functionnet.url::url_path
Signature
func url_path(url: String) -> Stringfunc url_path(url: String) -> String {
return __url_path(url);
}@briefProvides the system library operation `url_path`.
@detailsExecutes the `url_path` 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
- urlTarget URL string.
@returnReturns the operation result as `String`.
functionnet.url::URL.init
Signature
func init(self: net.url.URL, scheme: String, host: String, port: Int, path: String) -> Void func init(self: net.url.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::URL.deinit
Signature
func deinit(self: net.url.URL) -> Void func deinit(self: net.url.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.url::parse
Signature
func parse(raw: String) -> net.url.URL, ErrCodefunc parse(raw: String) -> net.url.URL, ErrCode {
let u: net.url.URL = parse_common(raw);
if std.len(u.scheme) == 0 || std.len(u.host) == 0 {@briefParses input data with `parse`.
@detailsExecutes the `parse` 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
- rawRaw encoded input string before validation, parsing, or normalization.
@returnReturns `net.url.URL, 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::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::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::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::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;
/*