Skip to main content

NativeEvent

Trait NativeEvent 

Source
pub trait NativeEvent:
    Event
    + Serialize
    + DeserializeOwned
    + DeclaredFields
    + Clone {
    type Full: Serialize + Clone + DeclaredFields;
    type Collector;

    const DIALECT: Dialect;
    const DONE: bool = false;

    // Required methods
    fn collector(
        flow: IdentityFlow,
        policy: TargetIdPolicy,
        limits: EventLimits,
    ) -> Self::Collector;
    fn collect(
        collector: &mut Self::Collector,
        event: Self,
    ) -> Result<(), TransformError>;
    fn collected(
        collector: Self::Collector,
    ) -> Result<Converted<Collected<Self::Full>>, TransformError>;
    fn event_name(&self) -> Option<&'static str>;
    fn is_terminal(&self) -> bool;
    fn tool_declarations(
        &self,
        complete_tool_names: bool,
    ) -> Vec<(String, ToolCallKind, Option<String>)>;

    // Provided methods
    fn responses_history(
        _value: &Self::Full,
    ) -> Option<&GenerateContentResponseBody> { ... }
    fn decode(value: Value) -> Result<Self, TransformError> { ... }
    fn collect_done(
        _collector: &mut Self::Collector,
    ) -> Result<(), TransformError> { ... }
    fn is_usage_only(&self) -> bool { ... }
}
Expand description

Sealed over the four actual generation event types.

Required Associated Constants§

Provided Associated Constants§

Source

const DONE: bool = false

Required Associated Types§

Required Methods§

Source

fn collector( flow: IdentityFlow, policy: TargetIdPolicy, limits: EventLimits, ) -> Self::Collector

Source

fn collect( collector: &mut Self::Collector, event: Self, ) -> Result<(), TransformError>

Source

fn collected( collector: Self::Collector, ) -> Result<Converted<Collected<Self::Full>>, TransformError>

Source

fn event_name(&self) -> Option<&'static str>

Source

fn is_terminal(&self) -> bool

Source

fn tool_declarations( &self, complete_tool_names: bool, ) -> Vec<(String, ToolCallKind, Option<String>)>

Complete emitted ID, actual call kind, and complete name if already known.

Provided Methods§

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§