pub struct TriggerSink { /* private fields */ }Expand description
Channel endpoint for triggers to emit TriggerEvents.
Obtained from TriggerSink::channel and passed to
Trigger::start.
§Examples
use ironflow_runtime::trigger::{TriggerSink, TriggerEvent};
use ironflow_store::entities::TriggerKind;
use serde_json::json;
let (sink, mut rx) = TriggerSink::channel(16);
sink.send(TriggerEvent {
workflow_name: "deploy".to_string(),
payload: json!({}),
trigger_kind: TriggerKind::Manual,
}).await.unwrap();
let event = rx.recv().await.unwrap();
assert_eq!(event.workflow_name, "deploy");Implementations§
Source§impl TriggerSink
impl TriggerSink
Sourcepub fn channel(buffer: usize) -> (Self, Receiver<TriggerEvent>)
pub fn channel(buffer: usize) -> (Self, Receiver<TriggerEvent>)
Create a sink/receiver pair with the given buffer capacity.
§Examples
use ironflow_runtime::trigger::TriggerSink;
let (sink, rx) = TriggerSink::channel(32);
drop(rx);Sourcepub async fn send(&self, event: TriggerEvent) -> Result<(), TriggerError>
pub async fn send(&self, event: TriggerEvent) -> Result<(), TriggerError>
Trait Implementations§
Source§impl Clone for TriggerSink
impl Clone for TriggerSink
Source§fn clone(&self) -> TriggerSink
fn clone(&self) -> TriggerSink
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for TriggerSink
impl RefUnwindSafe for TriggerSink
impl Send for TriggerSink
impl Sync for TriggerSink
impl Unpin for TriggerSink
impl UnsafeUnpin for TriggerSink
impl UnwindSafe for TriggerSink
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