Module Wire.FieldSource

Sourcetype 'a t

A named field carrying values of type 'a.

Sourcetype 'a anon

An anonymous (padding) field. Cannot be referenced.

Sourcetype packed =
  1. | Named : 'a t -> packed
  2. | Anon : 'a anon -> packed
Sourceval v : string -> ?constraint_:bool expr -> ?self_constraint:(int expr -> bool expr) -> ?action:Action.t -> 'a typ -> 'a t

v name typ creates a named field. ?self_constraint receives the field's own ref and returns a constraint over it; useful for proving a later size-expression safe (e.g. self >= int 7 when a later field uses byte_slice ~size:(ref len - int 7)).

Sourceval anon : 'a typ -> 'a anon

anon typ creates an anonymous (padding) field.

Sourceval ref : 'a t -> int expr

ref f returns the expression referencing this field's underlying integer value. Works on any field whose wire type is or wraps an integer, including bool fields created with bit.