lisette-stdlib 0.1.13

Little language inspired by Rust that compiles to Go
Documentation
// Generated by Lisette bindgen
// Source: fmt (Go stdlib)
// Go: 1.25.5
// Lisette: 0.1.12

import "go:io"

/// Append formats using the default formats for its operands, appends the result to
/// the byte slice, and returns the updated slice.
pub fn Append(mut b: Slice<uint8>, a: VarArgs<Unknown>) -> Slice<uint8>

/// Appendf formats according to a format specifier, appends the result to the byte
/// slice, and returns the updated slice.
pub fn Appendf(mut b: Slice<uint8>, format: string, a: VarArgs<Unknown>) -> Slice<uint8>

/// Appendln formats using the default formats for its operands, appends the result
/// to the byte slice, and returns the updated slice. Spaces are always added
/// between operands and a newline is appended.
pub fn Appendln(mut b: Slice<uint8>, a: VarArgs<Unknown>) -> Slice<uint8>

/// Errorf formats according to a format specifier and returns the string as a
/// value that satisfies error.
/// 
/// If the format specifier includes a %w verb with an error operand,
/// the returned error will implement an Unwrap method returning the operand.
/// If there is more than one %w verb, the returned error will implement an
/// Unwrap method returning a []error containing all the %w operands in the
/// order they appear in the arguments.
/// It is invalid to supply the %w verb with an operand that does not implement
/// the error interface. The %w verb is otherwise a synonym for %v.
pub fn Errorf(format: string, a: VarArgs<Unknown>) -> error

/// FormatString returns a string representing the fully qualified formatting
/// directive captured by the [State], followed by the argument verb. ([State] does not
/// itself contain the verb.) The result has a leading percent sign followed by any
/// flags, the width, and the precision. Missing flags, width, and precision are
/// omitted. This function allows a [Formatter] to reconstruct the original
/// directive triggering the call to Format.
pub fn FormatString(state: State, verb: int32) -> string

/// Fprint formats using the default formats for its operands and writes to w.
/// Spaces are added between operands when neither is a string.
/// It returns the number of bytes written and any write error encountered.
#[allow(unused_result)]
pub fn Fprint(w: io.Writer, a: VarArgs<Unknown>) -> Result<int, error>

/// Fprintf formats according to a format specifier and writes to w.
/// It returns the number of bytes written and any write error encountered.
#[allow(unused_result)]
pub fn Fprintf(w: io.Writer, format: string, a: VarArgs<Unknown>) -> Result<int, error>

/// Fprintln formats using the default formats for its operands and writes to w.
/// Spaces are always added between operands and a newline is appended.
/// It returns the number of bytes written and any write error encountered.
#[allow(unused_result)]
pub fn Fprintln(w: io.Writer, a: VarArgs<Unknown>) -> Result<int, error>

/// Fscan scans text read from r, storing successive space-separated
/// values into successive arguments. Newlines count as space. It
/// returns the number of items successfully scanned. If that is less
/// than the number of arguments, err will report why.
pub fn Fscan(r: io.Reader, a: VarArgs<Unknown>) -> Result<int, error>

/// Fscanf scans text read from r, storing successive space-separated
/// values into successive arguments as determined by the format. It
/// returns the number of items successfully parsed.
/// Newlines in the input must match newlines in the format.
pub fn Fscanf(r: io.Reader, format: string, a: VarArgs<Unknown>) -> Result<int, error>

/// Fscanln is similar to [Fscan], but stops scanning at a newline and
/// after the final item there must be a newline or EOF.
pub fn Fscanln(r: io.Reader, a: VarArgs<Unknown>) -> Result<int, error>

/// Print formats using the default formats for its operands and writes to standard output.
/// Spaces are added between operands when neither is a string.
/// It returns the number of bytes written and any write error encountered.
#[allow(unused_result)]
pub fn Print(a: VarArgs<Unknown>) -> Result<int, error>

/// Printf formats according to a format specifier and writes to standard output.
/// It returns the number of bytes written and any write error encountered.
#[allow(unused_result)]
pub fn Printf(format: string, a: VarArgs<Unknown>) -> Result<int, error>

/// Println formats using the default formats for its operands and writes to standard output.
/// Spaces are always added between operands and a newline is appended.
/// It returns the number of bytes written and any write error encountered.
#[allow(unused_result)]
pub fn Println(a: VarArgs<Unknown>) -> Result<int, error>

/// Scan scans text read from standard input, storing successive
/// space-separated values into successive arguments. Newlines count
/// as space. It returns the number of items successfully scanned.
/// If that is less than the number of arguments, err will report why.
pub fn Scan(a: VarArgs<Unknown>) -> Result<int, error>

/// Scanf scans text read from standard input, storing successive
/// space-separated values into successive arguments as determined by
/// the format. It returns the number of items successfully scanned.
/// If that is less than the number of arguments, err will report why.
/// Newlines in the input must match newlines in the format.
/// The one exception: the verb %c always scans the next rune in the
/// input, even if it is a space (or tab etc.) or newline.
pub fn Scanf(format: string, a: VarArgs<Unknown>) -> Result<int, error>

/// Scanln is similar to [Scan], but stops scanning at a newline and
/// after the final item there must be a newline or EOF.
pub fn Scanln(a: VarArgs<Unknown>) -> Result<int, error>

/// Sprint formats using the default formats for its operands and returns the resulting string.
/// Spaces are added between operands when neither is a string.
pub fn Sprint(a: VarArgs<Unknown>) -> string

/// Sprintf formats according to a format specifier and returns the resulting string.
pub fn Sprintf(format: string, a: VarArgs<Unknown>) -> string

/// Sprintln formats using the default formats for its operands and returns the resulting string.
/// Spaces are always added between operands and a newline is appended.
pub fn Sprintln(a: VarArgs<Unknown>) -> string

/// Sscan scans the argument string, storing successive space-separated
/// values into successive arguments. Newlines count as space. It
/// returns the number of items successfully scanned. If that is less
/// than the number of arguments, err will report why.
pub fn Sscan(str: string, a: VarArgs<Unknown>) -> Result<int, error>

/// Sscanf scans the argument string, storing successive space-separated
/// values into successive arguments as determined by the format. It
/// returns the number of items successfully parsed.
/// Newlines in the input must match newlines in the format.
pub fn Sscanf(str: string, format: string, a: VarArgs<Unknown>) -> Result<int, error>

/// Sscanln is similar to [Sscan], but stops scanning at a newline and
/// after the final item there must be a newline or EOF.
pub fn Sscanln(str: string, a: VarArgs<Unknown>) -> Result<int, error>

/// Formatter is implemented by any value that has a Format method.
/// The implementation controls how [State] and rune are interpreted,
/// and may call [Sprint] or [Fprint](f) etc. to generate its output.
pub interface Formatter {
  fn Format(f: State, verb: int32)
}

/// GoStringer is implemented by any value that has a GoString method,
/// which defines the Go syntax for that value.
/// The GoString method is used to print values passed as an operand
/// to a %#v format.
pub interface GoStringer {
  fn GoString() -> string
}

/// ScanState represents the scanner state passed to custom scanners.
/// Scanners may do rune-at-a-time scanning or ask the ScanState
/// to discover the next space-delimited token.
pub interface ScanState {
  fn Read(mut buf: Slice<uint8>) -> Partial<int, error>
  fn ReadRune() -> Result<(int32, int), error>
  fn SkipSpace()
  fn Token(skipSpace: bool, f: fn(int32) -> bool) -> Result<Slice<uint8>, error>
  fn UnreadRune() -> Result<(), error>
  fn Width() -> Option<int>
}

/// Scanner is implemented by any value that has a Scan method, which scans
/// the input for the representation of a value and stores the result in the
/// receiver, which must be a pointer to be useful. The Scan method is called
/// for any argument to [Scan], [Scanf], or [Scanln] that implements it.
pub interface Scanner {
  fn Scan(state: ScanState, verb: int32) -> Result<(), error>
}

/// State represents the printer state passed to custom formatters.
/// It provides access to the [io.Writer] interface plus information about
/// the flags and options for the operand's format specifier.
pub interface State {
  fn Flag(c: int) -> bool
  fn Precision() -> Option<int>
  fn Width() -> Option<int>
  fn Write(b: Slice<uint8>) -> Partial<int, error>
}

/// Stringer is implemented by any value that has a String method,
/// which defines the “native” format for that value.
/// The String method is used to print values passed as an operand
/// to any format that accepts a string or to an unformatted printer
/// such as [Print].
pub interface Stringer {
  fn String() -> string
}