pub struct WorkflowRegistry { /* private fields */ }Expand description
按名字存 workflow 函数。
跟 local:// 分支同一个道理:函数没法持久化,库里存的是名字,
重启后靠这张表把名字解析回函数。所以重启后必须注册同名的 workflow。
Implementations§
Source§impl WorkflowRegistry
impl WorkflowRegistry
pub fn new() -> Self
pub fn register<F, Fut>(&mut self, name: &str, f: F) -> &mut Selfwhere
F: Fn(WorkflowCtx) -> Fut + Send + Sync + 'static,
Fut: Future<Output = WorkflowResult<()>> + Send + 'static,
pub fn get( &self, name: &str, ) -> Option<Arc<dyn Fn(WorkflowCtx) -> Pin<Box<dyn Future<Output = WorkflowResult<()>> + Send>> + Send + Sync>>
pub fn contains(&self, name: &str) -> bool
pub fn names(&self) -> Vec<&str>
Trait Implementations§
Source§impl Debug for WorkflowRegistry
impl Debug for WorkflowRegistry
Source§impl Default for WorkflowRegistry
impl Default for WorkflowRegistry
Source§fn default() -> WorkflowRegistry
fn default() -> WorkflowRegistry
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl !RefUnwindSafe for WorkflowRegistry
impl !UnwindSafe for WorkflowRegistry
impl Freeze for WorkflowRegistry
impl Send for WorkflowRegistry
impl Sync for WorkflowRegistry
impl Unpin for WorkflowRegistry
impl UnsafeUnpin for WorkflowRegistry
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
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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> ⓘ
Converts
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> ⓘ
Converts
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request