Skip to main content

Config

Struct Config 

Source
pub struct Config { /* private fields */ }
Expand description

Build-script entry point.

Implementations§

Source§

impl Config

Source

pub fn new() -> Self

New config with sane defaults (lints + schemas + builders + arrow on).

Source

pub fn files(self, files: &[impl AsRef<Path>]) -> Self

Add proto file paths.

Source

pub fn include(self, dir: impl AsRef<Path>) -> Self

Add include directories searched by protoc.

Source

pub fn out_dir(self, dir: impl AsRef<Path>) -> Self

Override the output directory. Defaults to $OUT_DIR.

Source

pub fn include_obs_options(self) -> Self

Pull obs/v1/options.proto from the embedded obs-build package so the user does not need to vendor it. The proto file is bundled at compile time and extracted to $OUT_DIR/obs/include/.

Source

pub fn descriptor_source(self, src: DescriptorSource) -> Self

Use a pre-compiled FDS file (skips protoc).

Source

pub fn event_prefix(self, prefix: impl Into<String>) -> Self

Override the workspace event prefix used by lint L011. Defaults to reading OBS_EVENT_PREFIX env var, then falling back to "Obs". Spec 12 § 3.4.

Source

pub fn with_arrow_schema(self, on: bool) -> Self

Toggle Arrow schema fragment emission. On by default. Spec 12 § 4.

Source

pub fn with_json_render(self, on: bool) -> Self

Toggle JSON-render dispatcher. Off by default; lands in Phase 4. Spec 12 § 4.

Source

pub fn with_payload_scrub(self, on: bool) -> Self

Toggle payload scrub dispatcher. On by default. Spec 12 § 4.

Source

pub fn with_otel_attribute_view(self, on: bool) -> Self

Toggle OTel attribute view emission. On by default. Spec 12 § 4.

Source

pub fn compile(self) -> Result<(), CodegenError>

Run codegen.

Two-stage pipeline per spec 12 § 3:

  1. Stage 1 — buffa-build: compile the .proto files into Rust wire types under $OUT_DIR/obs_buffa.rs (one entry-point file via include_file). Skipped when the user pre-built the FDS via descriptor_source(Precompiled(_)) and there are no .proto files set on Config (the test path).
  2. Stage 2 — obs codegen: read (obs.v1.event) / (obs.v1.field) annotations from the descriptor pool and emit $OUT_DIR/obs/{schemas,builders,lints,arrow_schema}.rs.
§Errors

Returns CodegenError for any step that fails: protoc invocation, buffa-build invocation, FDS decode, option scan, generated-file IO.

Trait Implementations§

Source§

impl Debug for Config

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Config

Source§

fn default() -> Config

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.