blob: b244ecba73f34296028f0688eaf5b014860cf690 [file] [log] [blame]
// Copyright 2025 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef SRC_LIB_DIAGNOSTICS_FAKE_LOG_SINK_RUST_FAKE_LOG_SINK_H_
#define SRC_LIB_DIAGNOSTICS_FAKE_LOG_SINK_RUST_FAKE_LOG_SINK_H_
// NOTE: This file is autogenerated by cbindgen. Don't modify this manually. To regenerate
// this file:
//
// Add `--cargo-toml-gen` to your `fx set`. Then:
//
// fx build //build/rust:cargo_toml_gen //src/lib/diagnostics/fake-log-sink:rust
// fx gen-cargo //src/lib/diagnostics/fake-log-sink/rust
// cargo install cbindgen
// rustup default nightly
// cbindgen --output fake_log_sink.h
// fx format-code
#include <cstdint>
namespace fuchsia_logging {
namespace internal {
/// FakeLogSink serves LogSink connections and forward any messages logged to it.
struct FakeLogSink;
extern "C" {
/// Creates a new fake log sink.
FakeLogSink *fake_log_sink_new();
/// Deletes a log sink.
///
/// # Safety
///
/// `fake` must be from `fake_log_sink_new()`.
void fake_log_sink_delete(FakeLogSink *fake);
/// Serves a new connection
///
/// # Safety
///
/// `fake` must be from `fake_log_sink_new()` and `handle` must be valid.
void fake_log_sink_serve(FakeLogSink *fake, uint32_t handle);
/// Reads a new record.
///
///
/// # Safety
///
/// `fake` must be from `fake_log_sink_new()` and `dest` and `capacity` must be valid.
uintptr_t fake_log_sink_read_record(FakeLogSink *fake, uint8_t *dest, uintptr_t capacity);
/// Sets the minimum severity and notifies listeners.
///
/// # Panics
///
/// This will panic if `severity` is invalid.
///
/// # Safety
///
/// `fake` must be from `fake_log_sink_new()`.
void fake_log_sink_set_min_severity(FakeLogSink *fake, uint8_t severity);
/// Waits for a record to be ready and returns its size, or zero if timed out.
///
/// # Safety
///
/// `fake` must be from `fake_log_sink_new()`.
uintptr_t fake_log_sink_wait_for_record(FakeLogSink *fake, int64_t deadline_nanos);
} // extern "C"
} // namespace internal
} // namespace fuchsia_logging
#endif // SRC_LIB_DIAGNOSTICS_FAKE_LOG_SINK_RUST_FAKE_LOG_SINK_H_