pub struct WasmComponent {
pub exim: ExIm,
/* private fields */
}Fields§
§exim: ExImImplementations§
Source§impl WasmComponent
impl WasmComponent
Sourcepub async fn convert_core_module_to_component(
wasm_path: &Path,
input_content_digest: &ContentDigest,
output_parent: &Path,
) -> Result<Option<PathBuf>, Error>
pub async fn convert_core_module_to_component( wasm_path: &Path, input_content_digest: &ContentDigest, output_parent: &Path, ) -> Result<Option<PathBuf>, Error>
Convert input WASM file to a Component.
Return Ok(Some(output_path)) if conversion was successful. Output path is constructed as
{output_parent}/sha256_{input_digest}_transformed.wasm .
If the output path already exists, the conversion is skipped as it is assumed that Obelisk has made the transformation.
Return Ok(None) if the input file is a Component.
Sourcepub fn verify_wasm(wasm_path: impl AsRef<Path>) -> Result<(), DecodeError>
pub fn verify_wasm(wasm_path: impl AsRef<Path>) -> Result<(), DecodeError>
Attempt to open the WASM file, parse it using wit_parser.
Check that the file is a WASM Component.
pub fn new( wasm_path: impl AsRef<Path>, component_type: ComponentType, ) -> Result<Self, DecodeError>
Sourcepub fn new_from_wit_string(
wit: &str,
component_type: ComponentType,
) -> Result<Self, DecodeError>
pub fn new_from_wit_string( wit: &str, component_type: ComponentType, ) -> Result<Self, DecodeError>
Create a WasmComponent from a WIT string (no WASM binary).
Used for JS workflows/activities where the user interface is synthesized.
Sourcepub fn new_from_fn_signature(
ffqn: &FunctionFqn,
params: &[ParameterType],
return_type: &ReturnTypeExtendable,
component_type: ComponentType,
world_name: &str,
) -> Result<Self, DecodeError>
pub fn new_from_fn_signature( ffqn: &FunctionFqn, params: &[ParameterType], return_type: &ReturnTypeExtendable, component_type: ComponentType, world_name: &str, ) -> Result<Self, DecodeError>
Create a WasmComponent directly from a function signature, bypassing WIT text synthesis
and re-parsing. Used for JS activities/workflows/stubs where we already have all the type
information and don’t need the WIT text roundtrip that new_from_wit_string performs.
pub fn new_from_wit_folder( path: impl AsRef<Path>, component_type: ComponentType, ) -> Result<Self, DecodeError>
pub fn exported_functions(&self, extensions: bool) -> &[FunctionMetadata]
pub fn imported_functions(&self) -> &[FunctionMetadata]
Sourcepub fn wit(&self) -> String
pub fn wit(&self) -> String
Return the WIT text for this component, including obelisk extension packages.
Cannot fail: every constructor calls rebuild_resolve which already proves the stored
resolve is printable, so WitPrinter::print on it a second time is infallible.
pub fn exports_hierarchy_ext(&self) -> &[PackageIfcFns]
pub fn exported_extension_wits(&self) -> Result<HashMap<PkgFqn, String>, Error>
Trait Implementations§
Source§impl Clone for WasmComponent
impl Clone for WasmComponent
Source§fn clone(&self) -> WasmComponent
fn clone(&self) -> WasmComponent
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for WasmComponent
impl RefUnwindSafe for WasmComponent
impl Send for WasmComponent
impl Sync for WasmComponent
impl Unpin for WasmComponent
impl UnsafeUnpin for WasmComponent
impl UnwindSafe for WasmComponent
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more