pub struct BatchFileTriple { /* private fields */ }
Expand description
Represents the batch files associated with a specific index.
Implementations§
Source§impl BatchFileTriple
impl BatchFileTriple
pub async fn ensure_input_matches_output_and_error( &self, ) -> Result<(), BatchValidationError>
Source§impl BatchFileTriple
impl BatchFileTriple
pub fn index(&self) -> &BatchIndex
pub fn input(&self) -> &Option<PathBuf>
pub fn output(&self) -> &Option<PathBuf>
pub fn error(&self) -> &Option<PathBuf>
pub fn associated_metadata(&self) -> &Option<PathBuf>
pub fn workspace( &self, ) -> &Arc<dyn BatchWorkspaceInterface<Item = Arc<dyn GetTargetPathForAIExpansion + Sync + Send>>>
Source§impl BatchFileTriple
impl BatchFileTriple
Sourcepub fn new_for_test_with_workspace(
workspace: Arc<dyn BatchWorkspaceInterface<Item = Arc<dyn GetTargetPathForAIExpansion + Sync + Send>>>,
) -> BatchFileTriple
pub fn new_for_test_with_workspace( workspace: Arc<dyn BatchWorkspaceInterface<Item = Arc<dyn GetTargetPathForAIExpansion + Sync + Send>>>, ) -> BatchFileTriple
A convenience constructor for tests that supply a custom workspace. Everything else is None, and we assign a dummy index.
Sourcepub fn new_for_test_empty() -> BatchFileTriple
pub fn new_for_test_empty() -> BatchFileTriple
Some tests referred to “new_for_test_empty()”. We define it here as a convenience constructor that sets everything to None, with a dummy index and a MockBatchWorkspace.
Sourcepub fn set_index(&mut self, new_index: BatchIndex)
pub fn set_index(&mut self, new_index: BatchIndex)
Some tests set the index after constructing. We add a trivial setter:
pub fn effective_input_filename(&self) -> PathBuf
pub fn effective_output_filename(&self) -> PathBuf
pub fn effective_error_filename(&self) -> PathBuf
pub fn effective_metadata_filename(&self) -> PathBuf
Source§impl BatchFileTriple
impl BatchFileTriple
pub fn new_for_test_unique( workspace: Arc<dyn BatchWorkspaceInterface<Item = Arc<dyn GetTargetPathForAIExpansion + Sync + Send>>>, ) -> BatchFileTriple
pub fn new_for_test_with_metadata_path_unique( metadata_path: PathBuf, ) -> BatchFileTriple
pub fn get_done_directory(&self) -> &PathBuf
pub fn set_output_path(&mut self, path: Option<PathBuf>)
pub fn set_input_path(&mut self, path: Option<PathBuf>)
pub fn set_metadata_path(&mut self, path: Option<PathBuf>)
pub fn set_error_path(&mut self, path: Option<PathBuf>)
pub fn all_are_none(&self) -> bool
pub fn new_with_requests( requests: &[LanguageModelBatchAPIRequest], workspace: Arc<dyn BatchWorkspaceInterface<Item = Arc<dyn GetTargetPathForAIExpansion + Sync + Send>>>, ) -> Result<BatchFileTriple, BatchInputCreationError>
pub fn new_direct( index: &BatchIndex, input: Option<PathBuf>, output: Option<PathBuf>, error: Option<PathBuf>, associated_metadata: Option<PathBuf>, workspace: Arc<dyn BatchWorkspaceInterface<Item = Arc<dyn GetTargetPathForAIExpansion + Sync + Send>>>, ) -> BatchFileTriple
Sourcepub fn new_for_test_with_metadata_path(
metadata_path: PathBuf,
) -> BatchFileTriple
pub fn new_for_test_with_metadata_path( metadata_path: PathBuf, ) -> BatchFileTriple
A convenience constructor used by certain unit tests that only need
to set associated_metadata
while leaving other paths as None.
We assign a dummy BatchIndex
and a default MockBatchWorkspace (or any real workspace).
Sourcepub fn new_for_test_with_in_out_err_paths(
workspace: Arc<dyn BatchWorkspaceInterface<Item = Arc<dyn GetTargetPathForAIExpansion + Sync + Send>>>,
input: PathBuf,
output: Option<PathBuf>,
error: Option<PathBuf>,
) -> BatchFileTriple
pub fn new_for_test_with_in_out_err_paths( workspace: Arc<dyn BatchWorkspaceInterface<Item = Arc<dyn GetTargetPathForAIExpansion + Sync + Send>>>, input: PathBuf, output: Option<PathBuf>, error: Option<PathBuf>, ) -> BatchFileTriple
A convenience constructor used by certain unit tests that need to set
specific input, output, and error paths directly (often to temp files).
We assign a dummy BatchIndex
and a default MockBatchWorkspace.
Source§impl BatchFileTriple
impl BatchFileTriple
pub async fn move_input_and_output_to_done(&self) -> Result<(), FileMoveError>
pub async fn move_input_and_error_to_done(&self) -> Result<(), FileMoveError>
pub async fn move_all_to_done(&self) -> Result<(), FileMoveError>
Source§impl BatchFileTriple
impl BatchFileTriple
pub async fn ensure_input_matches_output( &self, ) -> Result<(), BatchValidationError>
Source§impl BatchFileTriple
impl BatchFileTriple
pub async fn ensure_input_matches_error( &self, ) -> Result<(), BatchValidationError>
Source§impl BatchFileTriple
impl BatchFileTriple
pub async fn retry_failed_requests( &self, error_data: &BatchErrorData, ) -> Result<(), BatchErrorProcessingError>
Source§impl BatchFileTriple
impl BatchFileTriple
pub async fn log_errors( &self, error_data: &BatchErrorData, ) -> Result<(), BatchErrorProcessingError>
Trait Implementations§
Source§impl<E> CheckBatchStatusOnline<E> for BatchFileTriplewhere
E: From<BatchDownloadError> + From<OpenAIClientError> + From<BatchMetadataError> + From<Error> + Debug,
impl<E> CheckBatchStatusOnline<E> for BatchFileTriplewhere
E: From<BatchDownloadError> + From<OpenAIClientError> + From<BatchMetadataError> + From<Error> + Debug,
fn check_batch_status_online<'life0, 'life1, 'async_trait>(
&'life0 self,
client: &'life1 dyn LanguageModelClientInterface<E, Error = E, Error = E, Error = E, Error = E, Error = E>,
) -> Pin<Box<dyn Future<Output = Result<BatchOnlineStatus, E>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
BatchFileTriple: 'async_trait,
Source§impl<E> CheckForAndDownloadOutputAndErrorOnline<E> for BatchFileTriplewhere
E: From<BatchDownloadError> + From<OpenAIClientError> + From<BatchMetadataError> + From<Error> + Debug + Display,
impl<E> CheckForAndDownloadOutputAndErrorOnline<E> for BatchFileTriplewhere
E: From<BatchDownloadError> + From<OpenAIClientError> + From<BatchMetadataError> + From<Error> + Debug + Display,
fn check_for_and_download_output_and_error_online<'life0, 'life1, 'async_trait>(
&'life0 mut self,
client: &'life1 dyn LanguageModelClientInterface<E, Error = E, Error = E, Error = E, Error = E, Error = E>,
) -> Pin<Box<dyn Future<Output = Result<(), E>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
BatchFileTriple: 'async_trait,
Source§impl Clone for BatchFileTriple
impl Clone for BatchFileTriple
Source§fn clone(&self) -> BatchFileTriple
fn clone(&self) -> BatchFileTriple
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for BatchFileTriple
impl Debug for BatchFileTriple
Source§impl<E> DownloadErrorFile<E> for BatchFileTriplewhere
E: From<BatchDownloadError> + From<Error> + From<BatchMetadataError> + From<OpenAIClientError> + Debug,
impl<E> DownloadErrorFile<E> for BatchFileTriplewhere
E: From<BatchDownloadError> + From<Error> + From<BatchMetadataError> + From<OpenAIClientError> + Debug,
fn download_error_file<'life0, 'life1, 'async_trait>(
&'life0 mut self,
client: &'life1 dyn LanguageModelClientInterface<E, Error = E, Error = E, Error = E, Error = E, Error = E>,
) -> Pin<Box<dyn Future<Output = Result<(), E>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
BatchFileTriple: 'async_trait,
Source§impl<E> DownloadOutputFile<E> for BatchFileTriplewhere
E: From<BatchDownloadError> + From<Error> + From<BatchMetadataError> + From<OpenAIClientError> + Debug,
impl<E> DownloadOutputFile<E> for BatchFileTriplewhere
E: From<BatchDownloadError> + From<Error> + From<BatchMetadataError> + From<OpenAIClientError> + Debug,
fn download_output_file<'life0, 'life1, 'async_trait>(
&'life0 mut self,
client: &'life1 dyn LanguageModelClientInterface<E, Error = E, Error = E, Error = E, Error = E, Error = E>,
) -> Pin<Box<dyn Future<Output = Result<(), E>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
BatchFileTriple: 'async_trait,
Source§impl<E> ExecuteReconciliationOperation<E> for BatchFileTriplewhere
E: From<BatchReconciliationError> + From<BatchDownloadError> + From<OpenAIClientError> + From<BatchMetadataError> + From<Error> + From<FileMoveError> + From<BatchOutputProcessingError> + From<BatchErrorProcessingError> + From<BatchValidationError> + Display + Debug,
impl<E> ExecuteReconciliationOperation<E> for BatchFileTriplewhere
E: From<BatchReconciliationError> + From<BatchDownloadError> + From<OpenAIClientError> + From<BatchMetadataError> + From<Error> + From<FileMoveError> + From<BatchOutputProcessingError> + From<BatchErrorProcessingError> + From<BatchValidationError> + Display + Debug,
fn execute_reconciliation_operation<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'async_trait>(
&'life0 mut self,
client: &'life1 dyn LanguageModelClientInterface<E, Error = E, Error = E, Error = E, Error = E, Error = E>,
operation: &'life2 BatchFileTripleReconciliationOperation,
expected_content_type: &'life3 ExpectedContentType,
process_output_file_fn: &'life4 for<'a> fn(&'a BatchFileTriple, &'a dyn BatchWorkspaceInterface<Item = Arc<dyn GetTargetPathForAIExpansion + Sync + Send>>, &'a ExpectedContentType) -> Pin<Box<dyn Future<Output = Result<(), BatchOutputProcessingError>> + Send + 'a>>,
process_error_file_fn: &'life5 for<'a> fn(&'a BatchFileTriple, &'a [BatchErrorFileProcessingOperation]) -> Pin<Box<dyn Future<Output = Result<(), BatchErrorProcessingError>> + Send + 'a>>,
) -> Pin<Box<dyn Future<Output = Result<Option<BatchFileReconciliationRecommendedCourseOfAction>, E>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
'life5: 'async_trait,
BatchFileTriple: 'async_trait,
Source§impl<C, E> FreshExecute<C, E> for BatchFileTriplewhere
C: LanguageModelClientInterface<E>,
E: Debug + Display + From<BatchProcessingError> + From<BatchDownloadError> + From<JsonParseError> + From<Error> + From<OpenAIClientError> + From<BatchMetadataError>,
impl<C, E> FreshExecute<C, E> for BatchFileTriplewhere
C: LanguageModelClientInterface<E>,
E: Debug + Display + From<BatchProcessingError> + From<BatchDownloadError> + From<JsonParseError> + From<Error> + From<OpenAIClientError> + From<BatchMetadataError>,
type Success = BatchExecutionResult
fn fresh_execute<'life0, 'life1, 'async_trait>(
&'life0 mut self,
client: &'life1 C,
) -> Pin<Box<dyn Future<Output = Result<BatchExecutionResult, E>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
BatchFileTriple: 'async_trait,
Source§impl From<&BatchFileTriple> for BatchFileState
impl From<&BatchFileTriple> for BatchFileState
Source§fn from(triple: &BatchFileTriple) -> BatchFileState
fn from(triple: &BatchFileTriple) -> BatchFileState
Determines the state of the batch files.
Source§impl Ord for BatchFileTriple
impl Ord for BatchFileTriple
Source§fn cmp(&self, other: &BatchFileTriple) -> Ordering
fn cmp(&self, other: &BatchFileTriple) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for BatchFileTriple
impl PartialEq for BatchFileTriple
Source§impl PartialOrd for BatchFileTriple
impl PartialOrd for BatchFileTriple
Source§impl<E> ReconcileUnprocessed<E> for BatchFileTriplewhere
E: From<BatchReconciliationError> + From<BatchDownloadError> + From<BatchErrorProcessingError> + From<BatchMetadataError> + From<BatchOutputProcessingError> + From<BatchValidationError> + From<FileMoveError> + From<OpenAIClientError> + From<Error> + Display + Debug + Send + Sync,
impl<E> ReconcileUnprocessed<E> for BatchFileTriplewhere
E: From<BatchReconciliationError> + From<BatchDownloadError> + From<BatchErrorProcessingError> + From<BatchMetadataError> + From<BatchOutputProcessingError> + From<BatchValidationError> + From<FileMoveError> + From<OpenAIClientError> + From<Error> + Display + Debug + Send + Sync,
fn reconcile_unprocessed<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 mut self,
client: &'life1 dyn LanguageModelClientInterface<E, Error = E, Error = E, Error = E, Error = E, Error = E>,
expected_content_type: &'life2 ExpectedContentType,
process_output_file_fn: &'life3 for<'a> fn(&'a BatchFileTriple, &'a dyn BatchWorkspaceInterface<Item = Arc<dyn GetTargetPathForAIExpansion + Sync + Send>>, &'a ExpectedContentType) -> Pin<Box<dyn Future<Output = Result<(), BatchOutputProcessingError>> + Send + 'a>>,
process_error_file_fn: &'life4 for<'a> fn(&'a BatchFileTriple, &'a [BatchErrorFileProcessingOperation]) -> Pin<Box<dyn Future<Output = Result<(), BatchErrorProcessingError>> + Send + 'a>>,
) -> Pin<Box<dyn Future<Output = Result<(), E>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
BatchFileTriple: 'async_trait,
Source§impl TryFrom<&BatchFileTriple> for BatchFileReconciliationRecommendedCourseOfAction
impl TryFrom<&BatchFileTriple> for BatchFileReconciliationRecommendedCourseOfAction
Source§type Error = BatchReconciliationError
type Error = BatchReconciliationError
Source§fn try_from(
triple: &BatchFileTriple,
) -> Result<BatchFileReconciliationRecommendedCourseOfAction, BatchReconciliationError>
fn try_from( triple: &BatchFileTriple, ) -> Result<BatchFileReconciliationRecommendedCourseOfAction, BatchReconciliationError>
impl<E> CheckAndDownloadInterface<E> for BatchFileTriplewhere
E: From<BatchDownloadError> + From<OpenAIClientError> + From<BatchMetadataError> + From<Error> + Debug + Display,
impl Eq for BatchFileTriple
impl Send for BatchFileTriple
impl Sync for BatchFileTriple
Auto Trait Implementations§
impl Freeze for BatchFileTriple
impl !RefUnwindSafe for BatchFileTriple
impl Unpin for BatchFileTriple
impl !UnwindSafe for BatchFileTriple
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
Source§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self
with the foreground set to
value
.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red()
and
green()
, which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg()
:
use yansi::{Paint, Color};
painted.fg(Color::White);
Set foreground color to white using white()
.
use yansi::Paint;
painted.white();
Source§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
Source§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
Source§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
Source§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
Source§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
Source§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
Source§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
Source§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
Source§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self
with the background set to
value
.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red()
and
on_green()
, which have the same functionality but
are pithier.
§Example
Set background color to red using fg()
:
use yansi::{Paint, Color};
painted.bg(Color::Red);
Set background color to red using on_red()
.
use yansi::Paint;
painted.on_red();
Source§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
Source§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
Source§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
Source§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
Source§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
Source§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
Source§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
Source§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
Source§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
Source§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
Source§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling Attribute
value
.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold()
and
underline()
, which have the same functionality
but are pithier.
§Example
Make text bold using attr()
:
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);
Make text bold using using bold()
.
use yansi::Paint;
painted.bold();
Source§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
Source§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi
Quirk
value
.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask()
and
wrap()
, which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk()
:
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);
Enable wrapping using wrap()
.
use yansi::Paint;
painted.wrap();
Source§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting()
due to conflicts with Vec::clear()
.
The clear()
method will be removed in a future release.
fn clear(&self) -> Painted<&T>
resetting()
due to conflicts with Vec::clear()
.
The clear()
method will be removed in a future release.Source§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the Condition
value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted
only when both stdout
and stderr
are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);