// Generated by Lisette bindgen
// Source: runtime/metrics (Go stdlib)
// Go: 1.25.10
// Lisette: 0.2.1

pub enum ValueKind: int {
  KindBad = 0,
  KindFloat64 = 2,
  KindFloat64Histogram = 3,
  KindUint64 = 1,
}

pub const KindBad: ValueKind = 0

pub const KindFloat64: ValueKind = 2

pub const KindFloat64Histogram: ValueKind = 3

pub const KindUint64: ValueKind = 1

/// All returns a slice of containing metric descriptions for all supported metrics.
pub fn All() -> Slice<Description>

/// Read populates each [Value] field in the given slice of metric samples.
/// 
/// Desired metrics should be present in the slice with the appropriate name.
/// The user of this API is encouraged to re-use the same slice between calls for
/// efficiency, but is not required to do so.
/// 
/// Note that re-use has some caveats. Notably, Values should not be read or
/// manipulated while a Read with that value is outstanding; that is a data race.
/// This property includes pointer-typed Values (for example, [Float64Histogram])
/// whose underlying storage will be reused by Read when possible. To safely use
/// such values in a concurrent setting, all data must be deep-copied.
/// 
/// It is safe to execute multiple Read calls concurrently, but their arguments
/// must share no underlying memory. When in doubt, create a new []Sample from
/// scratch, which is always safe, though may be inefficient.
/// 
/// Sample values with names not appearing in [All] will have their Value populated
/// as KindBad to indicate that the name is unknown.
pub fn Read(mut m: Slice<Sample>)

/// Description describes a runtime metric.
pub struct Description {
  pub Name: string,
  pub Description: string,
  pub Kind: ValueKind,
  pub Cumulative: bool,
}

/// Float64Histogram represents a distribution of float64 values.
pub struct Float64Histogram {
  pub Counts: Slice<uint64>,
  pub Buckets: Slice<float64>,
}

/// Sample captures a single metric sample.
pub struct Sample {
  pub Name: string,
  pub Value: Value,
}

/// Value represents a metric value returned by the runtime.
pub type Value

impl Value {
  /// Float64 returns the internal float64 value for the metric.
  /// 
  /// If v.Kind() != KindFloat64, this method panics.
  fn Float64(self) -> float64

  /// Float64Histogram returns the internal *Float64Histogram value for the metric.
  /// 
  /// If v.Kind() != KindFloat64Histogram, this method panics.
  fn Float64Histogram(self) -> Option<Ref<Float64Histogram>>

  /// Kind returns the tag representing the kind of value this is.
  fn Kind(self) -> ValueKind

  /// Uint64 returns the internal uint64 value for the metric.
  /// 
  /// If v.Kind() != KindUint64, this method panics.
  fn Uint64(self) -> uint64
}
