behaviortree-core 0.1.0

Core implementaion of behaviortree
Documentation
// Copyright © 2026 Stephan Kunz
//! Groot2 message type.

use alloc::{vec, vec::Vec};

use bytes::Bytes;

/// Message exchanged on a ZMTP socket — an ordered sequence of byte frames.
#[derive(Debug)]
pub struct Groot2Message(pub Vec<Bytes>);

impl Groot2Message {
	/// Return the frame at `index`, or `None` if out of bounds.
	pub fn get(&self, index: usize) -> Option<&Bytes> {
		self.0.get(index)
	}

	/// Append a frame.
	pub fn push_back(&mut self, bytes: Bytes) {
		self.0.push(bytes);
	}
}

impl From<Bytes> for Groot2Message {
	fn from(bytes: Bytes) -> Self {
		Self(vec![bytes])
	}
}