pub struct SentSignals { /* private fields */ }Expand description
The signals a workflow may send with
WorkflowContext::send_signal.
Built from the signal types themselves, never from hand-written names. It keeps a workflow from sending, by mistake, a signal that is not its own; it is not a security boundary: code running in a worker can reach the store and the internal API anyway.
§Examples
use ironflow_engine::signal::{SentSignals, Signal};
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize, JsonSchema)]
struct HumanReplied {
body: String,
}
impl Signal for HumanReplied {
const NAME: &'static str = "gitlab.human_replied";
}
let sent = SentSignals::new().allow::<HumanReplied>();
assert!(sent.allows(HumanReplied::NAME));
assert!(!sent.allows("ci.pipeline_finished"));Implementations§
Source§impl SentSignals
impl SentSignals
Sourcepub fn new() -> Self
pub fn new() -> Self
An empty declaration: no signal may be sent.
§Examples
use ironflow_engine::signal::SentSignals;
assert!(SentSignals::new().names().is_empty());Sourcepub fn allow<S: Signal>(self) -> Self
pub fn allow<S: Signal>(self) -> Self
Allow sending S.
§Examples
use ironflow_engine::signal::{SentSignals, Signal};
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize, JsonSchema)]
struct Deployed {
version: String,
}
impl Signal for Deployed {
const NAME: &'static str = "deploy.done";
}
let sent = SentSignals::new().allow::<Deployed>().allow::<Deployed>();
assert_eq!(sent.names(), ["deploy.done"]);Trait Implementations§
Source§impl Clone for SentSignals
impl Clone for SentSignals
Source§impl Debug for SentSignals
impl Debug for SentSignals
Source§impl Default for SentSignals
impl Default for SentSignals
impl Eq for SentSignals
Source§impl PartialEq for SentSignals
impl PartialEq for SentSignals
impl StructuralPartialEq for SentSignals
Auto Trait Implementations§
impl Freeze for SentSignals
impl RefUnwindSafe for SentSignals
impl Send for SentSignals
impl Sync for SentSignals
impl Unpin for SentSignals
impl UnsafeUnpin for SentSignals
impl UnwindSafe for SentSignals
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.