Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implement rust workflow #5538

Closed
wants to merge 1 commit into from
Closed

implement rust workflow #5538

wants to merge 1 commit into from

Conversation

rbran
Copy link
Contributor

@rbran rbran commented Jun 10, 2024

No description provided.

@negasora negasora added the Component: Rust API Issue needs changes to the Rust API label Jun 24, 2024
@emesare emesare self-requested a review July 8, 2024 20:54
Comment on lines +291 to +311
pub fn register_activity<I>(&self, activify: &Activity, subactivities: I) -> Activity
where
I: IntoIterator,
I::Item: IntoActivityName,
{
let subactivities_raw: Vec<BnString> = subactivities
.into_iter()
.map(|x| x.activity_name())
.collect();
let mut subactivities_ptr: Vec<*const _> =
subactivities_raw.iter().map(|x| x.as_ptr()).collect();
let result = unsafe {
BNWorkflowRegisterActivity(
self.as_raw(),
activify.as_raw(),
subactivities_ptr.as_mut_ptr(),
subactivities_ptr.len(),
)
};
unsafe { Activity::from_raw(ptr::NonNull::new(result).unwrap()) }
}
Copy link
Member

@emesare emesare Jul 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not work, given:

    let work = Workflow::new("testWorkflow");
    let activity = Activity::new_with_action("test", |ctx| {});
    work.register_activity::<Vec<String>>(&activity, vec![]);
    work.register(
        r#"{ 
            "title" : "Rust workflow",
            "description" : "",
            "capabilities" : []
        }"#,
    )
    .expect("workflow is registered");
    work.insert("core.function.translateTailCalls", ["test"]);

I don't know why but it fails in Workflow::Validate but it shouldn't fail if there is no subactivity.

Before we can merge this we need to figure out why this happens.

///
/// * `activity` - the Activity to register
/// * `subactivities` - the list of Activities to assign
pub fn register_activity<I>(&self, activify: &Activity, subactivities: I) -> Activity
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: activify -> activity

@emesare emesare self-assigned this Oct 12, 2024
@emesare
Copy link
Member

emesare commented Oct 19, 2024

Added with 3a94767, thanks!

@emesare emesare closed this Oct 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Rust API Issue needs changes to the Rust API
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants