ic_agent

Function to_request_id

source
pub fn to_request_id<'a, V>(value: &V) -> Result<RequestId, RequestIdError>
where V: 'a + Serialize,
Expand description

Derive the request ID from a serializable data structure. This does not include the ic-request domain prefix.

See Representation-independent Hashing of Structured Data from the IC spec for the method of calculation.

§Serialization

This section is only relevant if you’re using this function to hash your own types.

  • Per the spec, neither of bools, floats, or nulls are supported.
  • Enum variants are serialized identically to serde_json.
  • Option::None fields are omitted entirely.
  • Byte strings are serialized differently to arrays of bytes - use of serde_bytes is required for correctness.