-
Notifications
You must be signed in to change notification settings - Fork 224
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
implement rust workflow #5538
Conversation
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()) } | ||
} |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo: activify -> activity
Added with 3a94767, thanks! |
No description provided.