Skip to content

Commit

Permalink
add missing docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
ss2165 committed Nov 27, 2023
1 parent cc8b6c3 commit 08ecee1
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/extension/op_def.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use std::sync::Arc;

use smol_str::SmolStr;

use super::simple_op::OpEnum;
use super::{
Extension, ExtensionBuildError, ExtensionId, ExtensionRegistry, ExtensionSet, SignatureError,
};
Expand Down Expand Up @@ -212,6 +213,18 @@ impl SignatureFunc {
SignatureFunc::CustomFunc(func) => func.static_params(),
}
}

/// Compute the concrete signature ([FunctionType]).
///
/// # Panics
///
/// Panics if is [SignatureFunc::CustomFunc] and there are not enough type
/// arguments provided to match the number of static parameters.
///
/// # Errors
///
/// This function will return an error if the type arguments are invalid or
/// there is some error in type computation.
pub fn compute_signature(
&self,
def: &OpDef,
Expand Down Expand Up @@ -437,9 +450,11 @@ impl Extension {
}
}

/// Add an operation implemented as an [OpEnum], which can provide the data
/// required to define an [OpDef].
pub fn add_op_enum(
&mut self,
op: &(impl super::simple_op::OpEnum + OpName),
op: &(impl OpEnum + OpName),
) -> Result<&mut OpDef, ExtensionBuildError> {
let def = self.add_op(op.name(), op.description(), op.def_signature())?;

Expand Down
2 changes: 2 additions & 0 deletions src/extension/simple_op.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ pub trait OpEnum: OpName {
Self::from_op_def(ext.def(), ext.args()).ok()
}

/// Given the ID of the extension this operation is defined in, and a
/// registry containing that extension, return a [RegisteredEnum].
fn to_registered(
self,
extension_id: ExtensionId,
Expand Down

0 comments on commit 08ecee1

Please sign in to comment.