pub struct TeachingEngine { /* private fields */ }Expand description
Opens, meters, and settles bonded teaching sessions.
Implementations§
Source§impl TeachingEngine
impl TeachingEngine
pub fn new() -> Self
Sourcepub fn open(&self, terms: TeachTerms) -> Result<u64>
pub fn open(&self, terms: TeachTerms) -> Result<u64>
Open a session: the teacher’s bond is escrowed against its promised gain over the student’s measured baseline.
Sourcepub async fn ask<T: Teacher + ?Sized>(
&self,
session_id: u64,
teacher: &T,
state: &[f32],
) -> Result<TeachAnswer>
pub async fn ask<T: Teacher + ?Sized>( &self, session_id: u64, teacher: &T, state: &[f32], ) -> Result<TeachAnswer>
Ask the teacher one uncertain state. Meters one query_fee of tuition
and returns the teacher’s answer for the student to distill against.
Sourcepub fn close(&self, session_id: u64, final_eval: f64) -> Result<TeachReceipt>
pub fn close(&self, session_id: u64, final_eval: f64) -> Result<TeachReceipt>
Close the session against the student’s re-measured evaluation. The
promise (final_eval >= baseline + promised_gain) decides the bond.
Sourcepub fn ledger(&self) -> BondLedger
pub fn ledger(&self) -> BondLedger
The teacher-side honored/slashed record — same shape the reputation oracle sells for routing bonds.
Sourcepub fn open_sessions(&self) -> usize
pub fn open_sessions(&self) -> usize
Sessions currently open (bond escrowed, tuition metering).
Trait Implementations§
Source§impl Default for TeachingEngine
impl Default for TeachingEngine
Source§fn default() -> TeachingEngine
fn default() -> TeachingEngine
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl !Freeze for TeachingEngine
impl RefUnwindSafe for TeachingEngine
impl Send for TeachingEngine
impl Sync for TeachingEngine
impl Unpin for TeachingEngine
impl UnsafeUnpin for TeachingEngine
impl UnwindSafe for TeachingEngine
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more