pub struct DecisionTraceId(pub u64);Expand description
Stable numeric identifier for DecisionTraceId.
Tuple Fields§
§0: u64Implementations§
Source§impl DecisionTraceId
impl DecisionTraceId
Sourcepub const fn new(value: u64) -> DecisionTraceId
pub const fn new(value: u64) -> DecisionTraceId
Creates an identifier from its wire value.
Examples found in repository?
examples/decision_ticket.rs (line 20)
11fn main() -> Result<(), Box<dyn std::error::Error>> {
12 let mut canwu = Canwu::demo(1918)?;
13 let ids = Canwu::demo_ids();
14
15 open_aid_request(&mut canwu, ids)?;
16 refresh_aid_options(&mut canwu, ids)?;
17 resolve_aid_request(&mut canwu)?;
18
19 let trace = canwu
20 .decision_trace(canwu_api::DecisionTraceId::new(1))
21 .expect("utility decision trace");
22 println!("{}", serde_json::to_string_pretty(trace)?);
23
24 verify_persistence_and_replay(&canwu)?;
25 println!("snapshot_restore=ok exact_replay=ok");
26 Ok(())
27}More examples
examples/uncertainty_resolution.rs (line 168)
146fn random_branch() -> Result<(), Box<dyn std::error::Error>> {
147 let mut canwu = Canwu::demo(202)?;
148 canwu.register_plugin(&UncertaintyPlugin)?;
149 enqueue_ticket(
150 &mut canwu,
151 RANDOM_TICKET,
152 1,
153 DecisionControllerBinding::new(
154 "law-random-controller",
155 DecisionPolicyIdentity::new(DecisionPolicyKind::Random, "weighted-random", "1"),
156 DecisionAuthority::Actor {
157 actor: Canwu::demo_ids().commander,
158 },
159 ),
160 )?;
161 let selection_at = SimTime::EPOCH + SimDuration::days(1);
162 canwu.schedule_calendar_boundary(selection_at, vec![SystemCadence::Daily])?;
163 canwu.step_canonical()?.expect("random source boundary");
164 canwu
165 .step_canonical()?
166 .expect("generated decision resolution boundary");
167 let trace = canwu
168 .decision_trace(canwu_api::DecisionTraceId::new(1))
169 .expect("random decision trace");
170 println!("random_trace={}", serde_json::to_string(trace)?);
171 Ok(())
172}Trait Implementations§
Source§impl Clone for DecisionTraceId
impl Clone for DecisionTraceId
Source§fn clone(&self) -> DecisionTraceId
fn clone(&self) -> DecisionTraceId
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 moreimpl Copy for DecisionTraceId
Source§impl Debug for DecisionTraceId
impl Debug for DecisionTraceId
Source§impl Default for DecisionTraceId
impl Default for DecisionTraceId
Source§fn default() -> DecisionTraceId
fn default() -> DecisionTraceId
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for DecisionTraceId
impl<'de> Deserialize<'de> for DecisionTraceId
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<DecisionTraceId, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<DecisionTraceId, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for DecisionTraceId
impl Display for DecisionTraceId
impl Eq for DecisionTraceId
Source§impl Hash for DecisionTraceId
impl Hash for DecisionTraceId
Source§impl Ord for DecisionTraceId
impl Ord for DecisionTraceId
Source§fn cmp(&self, other: &DecisionTraceId) -> Ordering
fn cmp(&self, other: &DecisionTraceId) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl PartialEq for DecisionTraceId
impl PartialEq for DecisionTraceId
Source§impl PartialOrd for DecisionTraceId
impl PartialOrd for DecisionTraceId
Source§impl Serialize for DecisionTraceId
impl Serialize for DecisionTraceId
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl StructuralPartialEq for DecisionTraceId
Auto Trait Implementations§
impl Freeze for DecisionTraceId
impl RefUnwindSafe for DecisionTraceId
impl Send for DecisionTraceId
impl Sync for DecisionTraceId
impl Unpin for DecisionTraceId
impl UnsafeUnpin for DecisionTraceId
impl UnwindSafe for DecisionTraceId
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