EgretDoc
Back to Home
Location:system/bytes

Module

Module documentation.

modulebytes
@briefByte sequence utilities
@detailsProvides basic helpers for bytes/strings, including buffering and simple operations.
@see
  • index.html

Classes

Classes and inheritance.

classbytes::Buffer
@briefBuffer
class Buffer {
    /*
    @brief Internal storage

Functions

Free functions and class methods.

functionbytes::from_string
Signaturefunc from_string(s: String) -> bytes.Bytes
func from_string(s: String) -> bytes.Bytes {
    return s;
}
@briefConstructs the target representation from input with `from_string`.
@detailsExecutes the `from_string` 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
  • sInput string.
@returnReturns the operation result as `bytes.Bytes`.
functionbytes::to_string
Signaturefunc to_string(b: bytes.Bytes) -> String
func to_string(b: bytes.Bytes) -> String {
    return b;
}
@briefConverts to the target representation with `to_string`.
@detailsExecutes the `to_string` 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
  • bInput value used for comparison, computation, or conversion.
@returnReturns the operation result as `String`.
functionbytes::len
Signaturefunc len(b: bytes.Bytes) -> Int
func len(b: bytes.Bytes) -> Int {
    return std.len(b);
}
@briefReturns the element count or byte length with `len`.
@detailsExecutes the `len` 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
  • bInput value used for comparison, computation, or conversion.
@returnReturns the operation result as `Int`.
functionbytes::slice
Signaturefunc slice(b: bytes.Bytes, start: Int, end: Int) -> bytes.Bytes
func slice(b: bytes.Bytes, start: Int, end: Int) -> bytes.Bytes {
    return std.substr(b, start, end - start);
}
@briefProvides the system library operation `slice`.
@detailsExecutes the `slice` 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
  • bInput value used for comparison, computation, or conversion.
  • startZero-based starting index, byte offset, or range boundary for the operation.
  • endEnd index, byte offset, or range boundary for the operation.
@returnReturns the operation result as `bytes.Bytes`.
functionbytes::Buffer.init
Signaturefunc init(self: bytes.Buffer) -> Void
    func init(self: bytes.Buffer) -> Void {
        self.s = "";
    }
@briefInitialize a Buffer
@detailsResets internal storage to an empty string.
@param
  • selfBuffer instance
@returnVoid
functionbytes::Buffer.deinit
Signaturefunc deinit(self: bytes.Buffer) -> Void
    func deinit(self: bytes.Buffer) -> Void {
    }
@briefReleases fallback resources at the end of the `Buffer` 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
functionbytes::Buffer.dispose
Signaturefunc dispose(self: bytes.Buffer) -> Void
    func dispose(self: bytes.Buffer) -> Void {
        _ = self.reset();
    }
@briefExplicitly releases resources owned by `Buffer`.
@detailsThis method deterministically cleans up file descriptors, network connections, native handles, buffers, or other external resources. Implementations should be idempotent where possible, and repeated calls must not corrupt object state.
@param
  • selfThe current instance whose fields, handles, buffers, or external resources are read or modified by this method.
@returnVoid
functionbytes::Buffer.reset
Signaturefunc reset(self: bytes.Buffer) -> Void
    func reset(self: bytes.Buffer) -> Void {
        self.s = "";
    }
@briefReset the buffer
@detailsClears all written contents.
@param
  • selfBuffer instance
@returnVoid
functionbytes::Buffer.len
Signaturefunc len(self: bytes.Buffer) -> Int
    func len(self: bytes.Buffer) -> Int {
        return std.len(self.s);
    }
@briefGet length
@detailsReturns the current length in characters.
@param
  • selfBuffer instance
@returnCurrent length (number of characters)
functionbytes::Buffer.write_string
Signaturefunc write_string(self: bytes.Buffer, x: String) -> Void
    func write_string(self: bytes.Buffer, x: String) -> Void {
        self.s += x;
    }
@briefAppend a string
@detailsAppends x to the end of the buffer.
@param
  • selfBuffer instance
  • xString to append
@returnVoid
functionbytes::Buffer.write_bytes
Signaturefunc write_bytes(self: bytes.Buffer, x: bytes.Bytes) -> Void
    func write_bytes(self: bytes.Buffer, x: bytes.Bytes) -> Void {
        self.s += x;
    }
@briefWrites data with `Buffer.write_bytes`.
@detailsExecutes the `write_bytes` 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
  • selfThe current instance whose fields, handles, buffers, or external resources are read or modified by this method.
  • xInput value.
@returnVoid
functionbytes::Buffer.str
Signaturefunc str(self: bytes.Buffer) -> String
    func str(self: bytes.Buffer) -> String {
        return self.s;
    }
@briefGet buffer contents
@detailsReturns the accumulated contents as a String.
@param
  • selfBuffer instance
@returnCurrent contents
functionbytes::Buffer.bytes
Signaturefunc bytes(self: bytes.Buffer) -> bytes.Bytes
    func bytes(self: bytes.Buffer) -> bytes.Bytes {
        return self.s;
    }
@briefProvides the system library operation `Buffer.bytes`.
@detailsExecutes the `bytes` 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
  • selfThe current instance whose fields, handles, buffers, or external resources are read or modified by this method.
@returnReturns the operation result as `bytes.Bytes`.
functionbytes::concat
Signaturefunc concat(a: bytes.Bytes, b: bytes.Bytes) -> bytes.Bytes
func concat(a: bytes.Bytes, b: bytes.Bytes) -> bytes.Bytes {
    return (a + b);
}
@briefProvides the system library operation `concat`.
@detailsExecutes the `concat` 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
  • aInput value used for comparison, computation, or conversion.
  • bInput value used for comparison, computation, or conversion.
@returnReturns the operation result as `bytes.Bytes`.
functionbytes::compare
Signaturefunc compare(a: String, b: String) -> Int
func compare(a: String, b: String) -> Int {
    if (a == b) {
        return 0;
@briefCompare two strings
@param
  • aString a
  • bString b
@returnComparison result (0/-1/1)
@warningDo not use this function if you need lexicographical ordering.

Variables

Class fields (var).

varbytes::Buffer.s
TypeString
@briefInternal storage
@detailsHolds the accumulated string data
    var s: String;

    /*