pub struct SegmentExtensions { /* private fields */ }Expand description
Opaque extensions shared by every Segment variant.
Implementations§
Source§impl SegmentExtensions
impl SegmentExtensions
Sourcepub const fn new(
signature: String,
raw: Option<Payload>,
provider_data: Option<Vec<Envelope>>,
) -> Self
pub const fn new( signature: String, raw: Option<Payload>, provider_data: Option<Vec<Envelope>>, ) -> Self
Creates extensions while preserving raw and collection presence.
The item identity is not an argument, because a provider adapter does not
supply it here: reef stamps it from the identity the adapter already
declared on model::Event::ContentFinal. See
with_item_id.
Sourcepub fn with_item_id(self, id: String) -> Self
pub fn with_item_id(self, id: String) -> Self
Attaches the provider’s identity for the content item this segment is.
Reef calls this itself, with the id of the
model::Event::ContentFinal the segment was built from, which is why an
adapter never has to: the identity a provider declares on the stream is
the identity the record keeps. Setting it here twice is not a way to
disagree with the stream — reef overwrites whatever is present, because
model::StreamGrammar tracks exactly one identity per item and a second
place to say it would be a second thing to believe.
An adapter that wants a different identity in the record declares a
different one on the stream. A registration that wants to rewrite it
after the fact does so in
ModelHooks::after_model,
which is handed the whole item::Assistant before it is committed and
whose replacement is what both the transcript and the outward
Text/Thinking events then report.
Sourcepub fn item_id(&self) -> Option<&str>
pub fn item_id(&self) -> Option<&str>
Returns the provider’s identity for this content item, when one is known.
None for a segment no provider stream produced — one a hook composed,
or one restored from a record written before the identity was carried.
Sourcepub const fn raw_payload(&self) -> Option<&Payload>
pub const fn raw_payload(&self) -> Option<&Payload>
Returns the optional raw provider payload.
Sourcepub fn provider_data(&self) -> Option<&[Envelope]>
pub fn provider_data(&self) -> Option<&[Envelope]>
Returns ordered provider envelopes while retaining collection presence.
Trait Implementations§
Source§impl Clone for SegmentExtensions
impl Clone for SegmentExtensions
Source§impl Debug for SegmentExtensions
impl Debug for SegmentExtensions
Source§fn fmt(&self, formatter: &mut Formatter<'_>) -> Result
fn fmt(&self, formatter: &mut Formatter<'_>) -> Result
Reports the signature’s presence and withholds even its length.
The signature is the crate’s one credential-shaped value: a
provider-issued token reef neither produces nor interprets, whose only
job is to be replayed verbatim. Signature lengths are provider-stable, so
a byte count would fingerprint the provider and the reasoning mode behind
a transcript while helping nobody — a signature is debugged by whether it
survived a round trip, which SegmentExtensions::signature answers.