Function decode_ids

Source
pub fn decode_ids<T: From<Id>>(ids: impl IntoIterator<Item = Bytes>) -> Vec<T>
Expand description

Decode a list of bytes into a list of typed IDs.

ยงExample

For example, a list of AgentIds can be decoded from a list of bytes.

use bytes::Bytes;
use kitsune2_api::{AgentId, decode_ids};

let agents = vec![
    Bytes::from_static(b"agent1"),
    Bytes::from_static(b"agent2"),
];

let decoded_agents = decode_ids::<AgentId>(agents);