pub struct PrefillMonitor { /* private fields */ }Expand description
Panic-containing wrapper around one controlled-prefill observer.
Implementations§
Source§impl PrefillMonitor
impl PrefillMonitor
Sourcepub fn new(
implementation: Digest,
observer: impl PrefillObserver + 'static,
) -> Self
pub fn new( implementation: Digest, observer: impl PrefillObserver + 'static, ) -> Self
Creates one identified prefill observer.
Sourcepub const fn receipt(&self) -> Option<&PrefillReceipt>
pub const fn receipt(&self) -> Option<&PrefillReceipt>
Returns current accounting, including a contained failure when present.
Sourcepub fn begin(
&mut self,
progress: PrefillProgress,
) -> Result<(), PrefillObserverError>
pub fn begin( &mut self, progress: PrefillProgress, ) -> Result<(), PrefillObserverError>
Begins a prefill operation at zero admitted tokens.
§Errors
Returns a validation or contained reset failure.
Sourcepub fn poll(
&mut self,
progress: PrefillProgress,
) -> Result<ControlFlow, PrefillObserverError>
pub fn poll( &mut self, progress: PrefillProgress, ) -> Result<ControlFlow, PrefillObserverError>
Sourcepub fn observe_chunk(
&mut self,
progress: PrefillProgress,
) -> Result<ControlFlow, PrefillObserverError>
pub fn observe_chunk( &mut self, progress: PrefillProgress, ) -> Result<ControlFlow, PrefillObserverError>
Sourcepub fn finish(
&mut self,
finish: PrefillFinish,
) -> Result<PrefillReceipt, PrefillObserverError>
pub fn finish( &mut self, finish: PrefillFinish, ) -> Result<PrefillReceipt, PrefillObserverError>
Marks successful complete or stopped prefill and returns its receipt.
Stopped requires a stop returned by the wrapped observer. A successful
finish is terminal until Self::begin starts another call.
§Errors
Returns an error when the monitor failed or has not begun.
Auto Trait Implementations§
impl !RefUnwindSafe for PrefillMonitor
impl !Send for PrefillMonitor
impl !Sync for PrefillMonitor
impl !UnwindSafe for PrefillMonitor
impl Freeze for PrefillMonitor
impl Unpin for PrefillMonitor
impl UnsafeUnpin for PrefillMonitor
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