Skip to main content

SegmentExtensions

Struct SegmentExtensions 

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

Opaque extensions shared by every Segment variant.

Implementations§

Source§

impl SegmentExtensions

Source

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.

Source

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.

Source

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.

Source

pub fn signature(&self) -> &str

Returns the opaque reasoning-continuity signature.

Source

pub const fn raw_payload(&self) -> Option<&Payload>

Returns the optional raw provider payload.

Source

pub fn provider_data(&self) -> Option<&[Envelope]>

Returns ordered provider envelopes while retaining collection presence.

Source

pub fn into_parts( self, ) -> (String, Option<Payload>, Option<Vec<Envelope>>, Option<String>)

Transfers all extension fields.

Trait Implementations§

Source§

impl Clone for SegmentExtensions

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SegmentExtensions

Source§

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.

Source§

impl<'de> Deserialize<'de> for SegmentExtensions

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for SegmentExtensions

Source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. 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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.