Skip to content

Commit

Permalink
feat(computegraph): remove deprecated compute variants
Browse files Browse the repository at this point in the history
  • Loading branch information
maximmaxim345 committed Jan 7, 2025
1 parent 45a72fb commit 78504d4
Showing 1 changed file with 0 additions and 83 deletions.
83 changes: 0 additions & 83 deletions crates/computegraph/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1640,45 +1640,6 @@ impl ComputeGraph {
}
}

/// Computes the result for a given output port using the provided context, returning a boxed value.
///
/// This function is the untyped version of [`ComputeGraph::compute_with_context`].
///
/// This function behaves similarly to [`ComputeGraph::compute_untyped`], but uses
/// the values given in the context as described in [`ComputationContext`].
///
/// # Arguments
///
/// * `output` - The output port to compute.
/// * `context` - Collection of values used to perform the computation.
///
/// # Returns
///
/// A result containing the computed boxed value or an error.
///
/// # Errors
///
/// An error is returned if:
/// - The node is not found.
/// - The node has the incorrect output type
/// - An input port of the node or a dependency of the node are not connected, and
/// no value is provided via the context
/// - A cycle is detected in the graph.
#[deprecated]
pub fn compute_untyped_with_context(
&self,
output: OutputPortUntyped,
context: &ComputationContext,
) -> Result<Box<dyn SendSyncAny>, ComputeError> {
self.compute_untyped_with(
output,
&ComputationOptions {
context: Some(context),
},
None,
)
}

/// Computes the result for a given output port.
///
/// Use [`ComputeGraph::compute_with`] when caching or a context are needed.
Expand Down Expand Up @@ -1709,50 +1670,6 @@ impl ComputeGraph {
Ok(*res)
}

/// Computes the result for a given output port using the provided context
///
/// This function behaves similarly to [`ComputeGraph::compute`], but uses
/// the values given in the context as described in [`ComputationContext`].
///
/// # Arguments
///
/// * `output` - The output port to compute.
/// * `context` - Collection of values used to perform the computation,
///
/// # Returns
///
/// A result containing the computed boxed value or an error.
///
/// # Errors
///
/// An error is returned if:
/// - The node is not found.
/// - The node has the incorrect output type
/// - An input port of the node or a dependency of the node are not connected, and
/// no value is provided via the context
/// - A cycle is detected in the graph.
#[deprecated]
pub fn compute_with_context<T: 'static>(
&self,
output: OutputPort<T>,
context: &ComputationContext,
) -> Result<T, ComputeError> {
let res = self.compute_untyped_with(
output.port.clone(),
&ComputationOptions {
context: Some(context),
},
None,
)?;
let res = res
.into_any()
.downcast::<T>()
.map_err(|_| ComputeError::OutputTypeMismatch {
node: output.port.node,
})?;
Ok(*res)
}

/// Computes the result for a given output port using the provided options.
///
/// This function is the primary way to execute computations in the [`ComputeGraph`].
Expand Down

0 comments on commit 78504d4

Please sign in to comment.