lisette-stdlib 0.2.2

Little language inspired by Rust that compiles to Go
Documentation
// Generated by Lisette bindgen
// Source: expvar (Go stdlib)
// Go: 1.25.10
// Lisette: 0.2.1

import "go:net/http"

/// Do calls f for each exported variable.
/// The global variable map is locked during the iteration,
/// but existing entries may be concurrently updated.
pub fn Do(f: fn(KeyValue) -> ())

/// Get retrieves a named exported variable. It returns nil if the name has
/// not been registered.
pub fn Get(name: string) -> Option<Var>

/// Handler returns the expvar HTTP Handler.
/// 
/// This is only needed to install the handler in a non-standard location.
pub fn Handler() -> http.Handler

pub fn NewFloat(name: string) -> Ref<Float>

pub fn NewInt(name: string) -> Ref<Int>

pub fn NewMap(name: string) -> Ref<Map>

pub fn NewString(name: string) -> Ref<String>

/// Publish declares a named exported variable. This should be called from a
/// package's init function when it creates its Vars. If the name is already
/// registered then this will log.Panic.
pub fn Publish(name: string, v: Var)

/// Float is a 64-bit float variable that satisfies the [Var] interface.
pub type Float

/// Func implements [Var] by calling the function
/// and formatting the returned value using JSON.
pub type Func = fn() -> Unknown

/// Int is a 64-bit integer variable that satisfies the [Var] interface.
pub type Int

/// KeyValue represents a single entry in a [Map].
pub struct KeyValue {
  pub Key: string,
  pub Value: Option<Var>,
}

/// Map is a string-to-Var map variable that satisfies the [Var] interface.
pub type Map

/// String is a string variable, and satisfies the [Var] interface.
pub type String

/// Var is an abstract type for all exported variables.
pub interface Var {
  fn String() -> string
}

impl Float {
  /// Add adds delta to v.
  fn Add(self: Ref<Float>, delta: float64)

  /// Set sets v to value.
  fn Set(self: Ref<Float>, value: float64)

  fn String(self: Ref<Float>) -> string

  fn Value(self: Ref<Float>) -> float64
}

impl Func {
  fn String(self) -> string

  fn Value(self) -> Unknown
}

impl Int {
  fn Add(self: Ref<Int>, delta: int64)

  fn Set(self: Ref<Int>, value: int64)

  fn String(self: Ref<Int>) -> string

  fn Value(self: Ref<Int>) -> int64
}

impl Map {
  /// Add adds delta to the *[Int] value stored under the given map key.
  fn Add(self: Ref<Map>, key: string, delta: int64)

  /// AddFloat adds delta to the *[Float] value stored under the given map key.
  fn AddFloat(self: Ref<Map>, key: string, delta: float64)

  /// Delete deletes the given key from the map.
  fn Delete(self: Ref<Map>, key: string)

  /// Do calls f for each entry in the map.
  /// The map is locked during the iteration,
  /// but existing entries may be concurrently updated.
  fn Do(self: Ref<Map>, f: fn(KeyValue) -> ())

  fn Get(self: Ref<Map>, key: string) -> Option<Var>

  /// Init removes all keys from the map.
  #[allow(unused_value)]
  fn Init(self: Ref<Map>) -> Ref<Map>

  fn Set(self: Ref<Map>, key: string, av: Var)

  fn String(self: Ref<Map>) -> string
}

impl String {
  fn Set(self: Ref<String>, value: string)

  /// String implements the [Var] interface. To get the unquoted string
  /// use [String.Value].
  fn String(self: Ref<String>) -> string

  fn Value(self: Ref<String>) -> string
}