pub struct ProbeResult { /* private fields */ }Expand description
The result of a successful probe execution.
Contains the data payload and a SHA-256 content hash used for deduplication.
§Examples
use ironflow_runtime::trigger::polling::ProbeResult;
use serde_json::json;
let result = ProbeResult::new(json!({"rows": 5}));
assert!(!result.content_hash().is_empty());
assert_eq!(result.data()["rows"], 5);Implementations§
Source§impl ProbeResult
impl ProbeResult
Sourcepub fn new(data: Value) -> Self
pub fn new(data: Value) -> Self
Create a new probe result from a JSON payload.
The content hash is computed as SHA-256 of the canonical JSON representation.
§Examples
use ironflow_runtime::trigger::polling::ProbeResult;
use serde_json::json;
let r1 = ProbeResult::new(json!({"a": 1}));
let r2 = ProbeResult::new(json!({"a": 1}));
assert_eq!(r1.content_hash(), r2.content_hash());
let r3 = ProbeResult::new(json!({"a": 2}));
assert_ne!(r1.content_hash(), r3.content_hash());Sourcepub fn with_hash(data: Value, content_hash: String) -> Self
pub fn with_hash(data: Value, content_hash: String) -> Self
Create a new probe result with a pre-computed content hash.
Use this when the hash source differs from the JSON payload (e.g. the raw HTTP response body before parsing).
§Examples
use ironflow_runtime::trigger::polling::ProbeResult;
use serde_json::json;
let result = ProbeResult::with_hash(json!({"body": "..."}), "abc123".to_string());
assert_eq!(result.content_hash(), "abc123");Sourcepub fn data(&self) -> &Value
pub fn data(&self) -> &Value
The data payload.
§Examples
use ironflow_runtime::trigger::polling::ProbeResult;
use serde_json::json;
let result = ProbeResult::new(json!({"count": 3}));
assert_eq!(result.data()["count"], 3);Sourcepub fn content_hash(&self) -> &str
pub fn content_hash(&self) -> &str
The SHA-256 content hash.
§Examples
use ironflow_runtime::trigger::polling::ProbeResult;
use serde_json::json;
let result = ProbeResult::new(json!({"key": "val"}));
assert_eq!(result.content_hash().len(), 64);Trait Implementations§
Source§impl Clone for ProbeResult
impl Clone for ProbeResult
Source§fn clone(&self) -> ProbeResult
fn clone(&self) -> ProbeResult
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 ProbeResult
impl RefUnwindSafe for ProbeResult
impl Send for ProbeResult
impl Sync for ProbeResult
impl Unpin for ProbeResult
impl UnsafeUnpin for ProbeResult
impl UnwindSafe for ProbeResult
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