pub struct ConversionReport { /* private fields */ }Expand description
Every part outcome for one request conversion.
Implementations§
Source§impl ConversionReport
impl ConversionReport
Sourcepub fn downgraded(
&mut self,
kind: &'static str,
mime_type: Option<&str>,
to: &'static str,
detail: impl Into<String>,
)
pub fn downgraded( &mut self, kind: &'static str, mime_type: Option<&str>, to: &'static str, detail: impl Into<String>, )
Records a part carried in a lossier form, and warns.
Sourcepub fn omitted(
&mut self,
kind: &'static str,
mime_type: Option<&str>,
detail: impl Into<String>,
)
pub fn omitted( &mut self, kind: &'static str, mime_type: Option<&str>, detail: impl Into<String>, )
Records a part left out entirely, and warns.
Sourcepub fn outcomes(&self) -> &[PartOutcome]
pub fn outcomes(&self) -> &[PartOutcome]
Every recorded outcome, in the order the parts appeared.
Sourcepub fn omitted_parts(&self) -> impl Iterator<Item = &PartOutcome>
pub fn omitted_parts(&self) -> impl Iterator<Item = &PartOutcome>
The parts that did not reach the provider.
Sourcepub fn downgraded_parts(&self) -> impl Iterator<Item = &PartOutcome>
pub fn downgraded_parts(&self) -> impl Iterator<Item = &PartOutcome>
The parts that reached the provider in a lossier form.
Sourcepub fn has_omissions(&self) -> bool
pub fn has_omissions(&self) -> bool
Whether any part was left out.
Sourcepub fn has_losses(&self) -> bool
pub fn has_losses(&self) -> bool
Whether any part was omitted or downgraded.
Sourcepub fn into_error(self) -> Option<AdkError>
pub fn into_error(self) -> Option<AdkError>
An error naming every omitted part, for callers that must not send a partial request.
Returns None when nothing was omitted. Downgrades are excluded: the material still
reaches the model, and refusing them would reject the documented textual fallback.
§Example
use adk_model::part_conversion::ConversionReport;
let mut report = ConversionReport::new("bedrock");
report.omitted("InlineData", Some("audio/wav"), "unsupported media type");
let error = report.into_error().expect("an omission must produce an error");
assert!(error.to_string().contains("audio/wav"));Trait Implementations§
Source§impl Clone for ConversionReport
impl Clone for ConversionReport
Source§fn clone(&self) -> ConversionReport
fn clone(&self) -> ConversionReport
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for ConversionReport
impl RefUnwindSafe for ConversionReport
impl Send for ConversionReport
impl Sync for ConversionReport
impl Unpin for ConversionReport
impl UnsafeUnpin for ConversionReport
impl UnwindSafe for ConversionReport
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